且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在eclipse C / C ++项目中使用sqlite3.c和sqlite3.h

更新时间:2023-02-08 10:21:23

确保 pthread 库链接



换句话说,您的编译器命令(由Eclipse生成)应该是:



gcc shell.c sqlite3.c -lpthread -ldl



而不是



gcc shell.c sqlite3.c -ldl -lpthread



请参阅此处获取正确的命令行:



http://www.sqlite.org/howtocompile.html


I am trying to use amalgamated version of sqlite3.c and sqlite3.h in my C/C++ project. It has code in both C and C++. I am using eclipse IDE in UBUNTU 12.04.

Now my problem is that after having include sqlite3.h in my file where I need sqlite3.c functions and having added ld and pthread libraries in linker, i am still getting errors and cant build the project.

This is weird and should not happen. Please take a look at following screenshots that explain my problem.

************************************************************************************

************************************************************************************

What am I missing?

Please Help! Thanks

Make sure that the pthread library is linked before the dl library.

In other words, your compiler command (as generated by Eclipse) should be:

gcc shell.c sqlite3.c -lpthread -ldl

and not

gcc shell.c sqlite3.c -ldl -lpthread

See here for a correct command line:

http://www.sqlite.org/howtocompile.html