| Issue 2: | 请问怎么使用其中的sdk? | |
| 1 person starred this issue and may be notified of changes. | Back to list |
我下载用了,感觉不错,不过,我不知道怎么使用里面带的sdk,比如我要用 sqlite 库,大概 应该怎么弄?难道是整个copy到我的Project里面去?
Jan 11, 2010
只要在工程设置的搜索目录中添加: $(#SQL.include) 和 $(#SQL.lib) 分别对应头文件和库。 |
这帖子我在 CSDN 发过了,但这里可以上传附件,就再发到这里一次吧, 附件里面是我从官方网站下载的源文件编译出来的静态库: LZ,我用你的CodeBlocks里面带的SQLite无法链接以下程序: C/C++ code#include <stdio.h> #include <stdlib.h> #include "sqlite3.h" #define SQLITE3_STATIC static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName) { int i; for ( i=0; i<argc; i++ ) { printf( "%s = %s\n", aszColName[i], argv[i] == 0 ? "NUL" : argv[i] ); } return 0; } int main(int argc, char * argv[]) { const char * sSQL = "select * from t1;"; char * pErrMsg = 0; int ret = 0; sqlite3 * db = 0; ret = sqlite3_open("./app.db", &db); if ( ret != SQLITE_OK ) { fprintf(stderr, "Could not open database: %s", sqlite3_errmsg(db)); exit(1); } printf("Successfully connected to database\n"); sqlite3_exec( db, sSQL, _callback_exec, 0, &pErrMsg ); if ( ret != SQLITE_OK ) { fprintf(stderr, "SQL error: %s\n", pErrMsg); sqlite3_free(pErrMsg); } sqlite3_close(db); db = 0; return 0; } 后来去她的官方主页下载了源文件,编译了一份静态库,编译成功了, 你试一下看看,是我弄得不对么? 用你带的版本时,我设置了 build options -> search directories -> compiler 为: \sdk\sqlite\include 设置了 build options -> search directories -> linker为 \sdk\sqlite\lib 设置了 build options -> linker settings -> link libraries 为 \sdk\sqlite\lib\libsqlite3.a 链接的时候,报了8个无法解析的外部链接: ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `__gxx_personality_sj0'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `_Unwind_SjLj_Register'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `_Unwind_SjLj_Unregister'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `_Unwind_SjLj_Resume'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `__gxx_personality_sj0'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `_Unwind_SjLj_Register'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `_Unwind_SjLj_Unregister'| ..\..\CodeBlocksPortable\sdk\sqlite\lib\libsqlite3.a(codecext.o):codecext.cpp|| undefined reference to `_Unwind_SjLj_Resume'| ||=== Build finished: 8 errors, 0 warnings ===| 你有兴趣的话,看看吧。607 KB Download