I need to run C++ code via eclipse which has SQlite. I can run it via terminal with typing g++ test.cpp -lsqlite3 . but how can I run it via Eclipse? how should pur the command "-lsqlite3" in its configuration? thanks

this is the begging of the code

#include <sqlite3.h> #include <stdlib.h> #include <string.h> // g++ test.cpp -lsqlite3

According to the Eclipse FAQ on adding libraries:

Adding C/C++ External Libraries

How do I add an external library to my C++ project?  

Go to Your Project's Properties by right clicking on project's name and selecting   
properties. Click on "C/C++ Build". Under Tool Settings Tab, click on Directories.   
Click on The Add Button and Select FileSystem. Select the folder with C/C++ libraries.  
Apply and then Ok. The new library is included.  

The option commented before didn't work when I tried it. I solve it including the  
external library I want to add (libwsock32.a in my case) in Project->Properties->Tool   
Settings Tab->C++ Linker->Miscellaneous.  

14:26, 18 December 2007 (EST): Neither of these worked for me under Linux. I had to open  
up the project's properties and go to "C/C++ Build" -> "Settings" and then hit the  
"Libraries" item under "GCC C++ Linker" heading in the list on the right. Then, I  
entered the libraries as I would in the command line ("pthread" for libpthread, etc...).  
(Dustin Oprea)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.