如何在eclipse C / C ++项目中使用sqlite3.c和sqlite3.h [英] How to use sqlite3.c and sqlite3.h in eclipse C/C++ project
问题描述
我试图在我的C / C ++项目中使用合并版本的sqlite3.c和sqlite3.h。它有C和C ++的代码。我在UBUNTU 12.04中使用eclipse IDE。
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.
现在我的问题是,在我的文件中包含sqlite3.h,我需要sqlite3.c函数,并添加了ld和pthread库在链接器,我仍然得到错误,不能建立项目。
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.
我缺少什么?
感谢
推荐答案
确保 pthread / em> dll 库。
Make sure that the pthread library is linked before the dl library.
换句话说,你的编译器命令(由Eclipse生成)应该是:
In other words, your compiler command (as generated by Eclipse) should be:
gcc shell.c sqlite3.c -lpthread -ldl
gcc shell.c sqlite3.c -lpthread -ldl
而不是
gcc shell.c sqlite3.c -ldl -lpthread
gcc shell.c sqlite3.c -ldl -lpthread
查看正确的命令行:
http://www.sqlite.org/howtocompile.html
这篇关于如何在eclipse C / C ++项目中使用sqlite3.c和sqlite3.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!