如何在eclipse C / C ++项目中使用sqlite3.c和sqlite3.h [英] How to use sqlite3.c and sqlite3.h in eclipse C/C++ project

查看:237
本文介绍了如何在eclipse C / C ++项目中使用sqlite3.c和sqlite3.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在C / C ++项目中使用sqlite3.c和sqlite3.h的合并版本。它在C和C ++中都有代码。我在UBUNTU 12.04中使用eclipse IDE。



现在我的问题是,在我的文件中包含sqlite3.h之后,我需要sqlite3.c函数,并添加了ld和链接器中的pthread库,我仍然收到错误,无法构建项目。



这很奇怪,不应该发生。请看下面的截图说明我的问题。





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





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





我缺少什么?



请帮助!
谢谢

解决方案

确保 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

这篇关于如何在eclipse C / C ++项目中使用sqlite3.c和sqlite3.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆