免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3726 | 回复: 0
打印 上一主题 下一主题

[应用] GCC 链接出现未定义错误 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-05-15 00:36 |只看该作者 |倒序浏览
本帖最后由 aini1987114 于 2011-05-15 00:39 编辑

交叉链接时出现的未定义错误:命令没问题了gcc sync_sqlite3.c -L /usr/lib -lcurl -ljson -luuid -lsync_sqlite3    -o  sync_sqlite3


huang@huang-desktop:~/lunwen/sync_sqlite3$gcc sync_sqlite3.c -L /usr/lib -lcurl -ljson -luuid -lsync_sqlite3    -o  sync_sqlite3
sync_sqlite3.c: In function ‘update_hook’:
sync_sqlite3.c:16: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘sqlite3_int64’
sync_sqlite3.c:31: warning: format ‘%d’ expects type ‘int’, but argument 7 has type ‘sqlite3_int64’
sync_sqlite3.c:33: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘sqlite3_int64’
sync_sqlite3.c: In function ‘sqlite3_sync_set_sync_url’:
sync_sqlite3.c:76: warning: conversion lacks type at end of format
sync_sqlite3.c: In function ‘sqlite3_sync_set_fiter_condition’:
sync_sqlite3.c:86: warning: conversion lacks type at end of format
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o: In function `_start':
(.text+0x1: undefined reference to `main'
/tmp/cc0yEPs9.o: In function `update_hook':
sync_sqlite3.c.text+0x15e): undefined reference to `sqlite3_get_table'
sync_sqlite3.c.text+0x2b3): undefined reference to `sqlite3_exec'
/tmp/cc0yEPs9.o: In function `uuidgen':
sync_sqlite3.c.text+0x349): undefined reference to `sqlite3_result_text'
/tmp/cc0yEPs9.o: In function `sqlite3_sync_set_userpwd':
sync_sqlite3.c.text+0x3e3): undefined reference to `sqlite3_exec'
/tmp/cc0yEPs9.o: In function `sqlite3_sync_set_sync_url':
sync_sqlite3.c.text+0x46a): undefined reference to `sqlite3_exec'
/tmp/cc0yEPs9.o: In function `sqlite3_sync_set_fiter_condition':
sync_sqlite3.c.text+0x4f1): undefined reference to `sqlite3_exec'
/tmp/cc0yEPs9.o: In function `sqlite3_sync_config':
sync_sqlite3.c.text+0x534): undefined reference to `sqlite3_exec'
sync_sqlite3.c.text+0x55f): undefined reference to `sqlite3_exec'
/tmp/cc0yEPs9.o:sync_sqlite3.c.text+0x58a): more undefined references to `sqlite3_exec' follow
/tmp/cc0yEPs9.o: In function `sqlite3_sync_config':
sync_sqlite3.c.text+0x5ba): undefined reference to `sqlite3_get_table'
sync_sqlite3.c:(.text+0x5ec): undefined reference to `sqlite3_exec'
sync_sqlite3.c:(.text+0x5f7): undefined reference to `sqlite3_free_table'
/tmp/cc0yEPs9.o: In function `sqlite3_upload_sync':
sync_sqlite3.c:(.text+0x70: undefined reference to `sqlite3_get_table'
sync_sqlite3.c:(.text+0x970): undefined reference to `sqlite3_free_table'
sync_sqlite3.c:(.text+0xa2a): undefined reference to `sqlite3_get_table'
sync_sqlite3.c:(.text+0xa7: undefined reference to `sqlite3_free_table'
sync_sqlite3.c:(.text+0xc6b): undefined reference to `sqlite3_get_table'
sync_sqlite3.c:(.text+0xc84): undefined reference to `sqlite3_free_table'
sync_sqlite3.c:(.text+0xd70): undefined reference to `sqlite3_exec'
sync_sqlite3.c:(.text+0xd9a): undefined reference to `sqlite3_exec'
/tmp/cc0yEPs9.o: In function `sqlite3_download_sync':
sync_sqlite3.c:(.text+0xfb5): undefined reference to `sqlite3_get_table'
sync_sqlite3.c:(.text+0xffc): undefined reference to `sqlite3_free_table'
sync_sqlite3.c:(.text+0x1062): undefined reference to `sqlite3_get_table'
sync_sqlite3.c:(.text+0x10ff): undefined reference to `sqlite3_free_table'
collect2: ld returned 1 exit status


C文件中没有没有定义上述函数
     


这是我的sync_sqlite3.h文件

#endif
   void update_hook(void* inData,int modifyType,char const * dbName,char const * tableName,sqlite3_int64 rowid);
   void uuidgen(sqlite3_context* ctx,int argc,sqlite3_value ** argv);
   int sqlite3_sync_set_userpwd(char* username,char* password,sqlite3* conn);
   int sqlite3_sync_set_sync_url(char* sync_url,sqlite3* conn);
   int sqlite3_sync_set_fiter_condition(char* fiter_condition,sqlite3* conn);
   int sqlite3_sync_config(sqlite3 * conn);
   //size_t print_response(void* ptr,size_t size,size_t nmemb,void* stream);
   int sqlite3_upload_sync(sqlite3* db,char* table_name,int modify_type);
   int sqlite3_download_sync(sqlite3* db,char* table_name,int modify_type);
   
#ifdef        __cplusplus

这个问题如何解决?是否要修改c源程序,定义相关函数?还是在头文件(sync_sqlite3.h)中修改,定义上面未定义函数?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP