Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » SQLite library for C++(How link sqlite3 in eclipse?)
SQLite library for C++ [message #1390010] Sat, 28 June 2014 19:11 Go to next message
Ondra Yogger is currently offline Ondra Yogger
Messages: 4
Registered: June 2014
Junior Member
Hi guys,

I am new to c++ and eclipse and I have come to this problem. I dont know how corectly link sqlite3 api to my c++ project in eclipse.

I am trying to compile and execute simple example of connecting to database (from tutorial), but it ends with these errors:

undefined reference to `sqlite3_open'
undefined reference to `sqlite3_errmsg'
undefined reference to `sqlite3_close'

I am using ubuntu and I already installed libsqlite3-dev. I am able to create and manage db in command line, so I know it is working.
I also know that most probably I have to change theese settings:

Properties>>C/C++ Build>>Settings>>GCC C++ Compiler >> Includes
Properties>>C/C++ Build>>Settings>>GCC C++ Linker >> Libraries

but I dont know how exactly. Could anyone help me please?

Thanks
Re: SQLite library for C++ [message #1390516 is a reply to message #1390010] Sun, 29 June 2014 15:28 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1952
Registered: July 2009
Senior Member
http://wiki.eclipse.org/CDT/User/FAQ#Adding_C.2FC.2B.2B_External_Libraries

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: SQLite library for C++ [message #1394563 is a reply to message #1390516] Sat, 05 July 2014 14:02 Go to previous messageGo to next message
Ondra Yogger is currently offline Ondra Yogger
Messages: 4
Registered: June 2014
Junior Member
I have followed instructions for linux and got rid off errors I had, but
now I have this one:

make all 
Building target: SQLiteTest
Invoking: GCC C Linker
gcc -L/usr/include/ -o "SQLiteTest"  ./hello.o   -lsqlite3.h 
/usr/bin/ld: cannot find -lsqlite3.h
collect2: error: ld returned 1 exit status
make: *** [SQLiteTest] Error 1


I checked /usr/include/ and there really is sqlite3.h file.
Could you help me with that please?

Thank you.
Re: SQLite library for C++ [message #1394691 is a reply to message #1394563] Sat, 05 July 2014 18:56 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1341
Registered: July 2009
Senior Member
On 07/05/2014 09:02 AM, Ondra Yogger wrote:
> I have followed instructions for linux and got rid off errors I had, but
> now I have this one:
>
>
> make all Building target: SQLiteTest
> Invoking: GCC C Linker
> gcc -L/usr/include/ -o "SQLiteTest" ./hello.o -lsqlite3.h
> /usr/bin/ld: cannot find -lsqlite3.h
> collect2: error: ld returned 1 exit status
> make: *** [SQLiteTest] Error 1
>
>
> I checked /usr/include/ and there really is sqlite3.h file.
> Could you help me with that please?
>
> Thank you.
You are confusing a header file with a library. You don't pass header
files to the linker. Go back to the Libraries settings for the linker
and give the library name (most likely sqlite3) instead of the header
file name.
Re: SQLite library for C++ [message #1394942 is a reply to message #1394691] Sun, 06 July 2014 05:00 Go to previous messageGo to next message
Ondra Yogger is currently offline Ondra Yogger
Messages: 4
Registered: June 2014
Junior Member
Solved, thank You very much.
Re: SQLite library for C++ [message #1394945 is a reply to message #1394691] Sun, 06 July 2014 05:01 Go to previous message
Ondra Yogger is currently offline Ondra Yogger
Messages: 4
Registered: June 2014
Junior Member
Solved. Thank you very much.
Previous Topic:Cygwin error parser - no mapping for cygdrive
Next Topic:C11 _Static_assert flagged as syntax error in file scope
Goto Forum:
  


Current Time: Fri Sep 19 07:49:22 GMT 2014

Powered by FUDForum. Page generated in 0.13589 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software