How to use sqlite3.c and sqlite3.h in eclipse C/C++ project

强颜欢笑 提交于 2019-12-13 01:52:53

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/13859956/how-to-use-sqlite3-c-and-sqlite3-h-in-eclipse-c-c-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!