tokyo cabate C程序的编译问题
我是东京内阁的新手,我已经安装了它,并且我已经运行了示例 C 程序,但出现错误... 当我用 gcc 编译时,
gcc -O tcadbex.c
/tmp/cc7IEOht.o: In function `main':
tcadbex.c:(.text+0xd): undefined reference to `tcadbnew'
tcadbex.c:(.text+0x1f): undefined reference to `tcadbopen'
tcadbex.c:(.text+0x58): undefined reference to `tcadbput2'
tcadbex.c:(.text+0x74): undefined reference to `tcadbput2'
tcadbex.c:(.text+0x90): undefined reference to `tcadbput2'
tcadbex.c:(.text+0xc1): undefined reference to `tcadbget2'
tcadbex.c:(.text+0x10e): undefined reference to `tcadbiterinit'
tcadbex.c:(.text+0x11c): undefined reference to `tcadbget2'
tcadbex.c:(.text+0x156): undefined reference to `tcadbiternext2'
tcadbex.c:(.text+0x164): undefined reference to `tcadbclose'
tcadbex.c:(.text+0x18d): undefined reference to `tcadbdel'
collect2: ld returned 1 exit status
任何人都可以告诉我这有什么问题吗?
i am new to tokyo cabinet and i have installed it and i have run the example c program i am getting error...
while i compile with gcc
gcc -O tcadbex.c
/tmp/cc7IEOht.o: In function `main':
tcadbex.c:(.text+0xd): undefined reference to `tcadbnew'
tcadbex.c:(.text+0x1f): undefined reference to `tcadbopen'
tcadbex.c:(.text+0x58): undefined reference to `tcadbput2'
tcadbex.c:(.text+0x74): undefined reference to `tcadbput2'
tcadbex.c:(.text+0x90): undefined reference to `tcadbput2'
tcadbex.c:(.text+0xc1): undefined reference to `tcadbget2'
tcadbex.c:(.text+0x10e): undefined reference to `tcadbiterinit'
tcadbex.c:(.text+0x11c): undefined reference to `tcadbget2'
tcadbex.c:(.text+0x156): undefined reference to `tcadbiternext2'
tcadbex.c:(.text+0x164): undefined reference to `tcadbclose'
tcadbex.c:(.text+0x18d): undefined reference to `tcadbdel'
collect2: ld returned 1 exit status
can any one tell me what is the issues with this...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您几乎肯定必须链接到 Tokyo Cabinate 的库文件(无论是什么)。
通常,您将使用如下命令:
其中:
-L
指定库的搜索路径。-l
列出用于搜索未定义符号的库。链接器将按照一定的规则寻找库,将
xyz
转换为libxyz.so
这样的文件名。事实上,在网络上搜索会发现这个(在一行中,我'我只是为了可读性而将其拆分):
作为要使用的命令行。
所以我建议您需要针对您的具体情况(再次,一行):
Yes, you will almost certainly have to link with the library files for Tokyo Cabinate (whatever that is).
Typically, you would use a command like:
where:
-L
specifies search paths for libraries.-l
lists libraries to search for undefined symbols.and the linker will go looking for the libraries, following certain rules for turning
xyz
into a file name likelibxyz.so
.In fact, a search of the net turns up this (on one line, I'm just splitting it for readability):
as the command line to use.
so I would suggest that you need for your specific case (again, on one line):