原因不明的链接错误

时间:2017-11-19 10:40:47

标签: c gcc linker

我正在尝试编译一个简单的演示应用程序:

gcc -Iinstall/include/ -Linstall/lib/ -lucp -lucs ucp_hello_world.c

并且有很多连锁错误:

/tmp/ccM7lrxs.o: In function `ucp_init':
ucp_hello_world.c:(.text+0x4a9): undefined reference to `ucp_init_version'
/tmp/ccM7lrxs.o: In function `send_handle':
ucp_hello_world.c:(.text+0x4f9): undefined reference to `ucs_status_string'
/tmp/ccM7lrxs.o: In function `failure_handler':
ucp_hello_world.c:(.text+0x550): undefined reference to `ucs_status_string'
...
many more errors...

但是在跑步时:

nm install/lib/libucp.a | grep ucp_init_version
nm install/lib/libucs.a | grep ucs_status_string

似乎符号存在:

0000000000000240 T ucp_init_version  

                 U ucs_status_string
                 U ucs_status_string
                 U ucs_status_string
                 U ucs_status_string
0000000000000000 T ucs_status_string

那么我做错了什么? (它可能与libucp.so和libucp.a以及libucp.la在同一文件夹中的事实有关)吗?

(P.S也试用了-lucp -lucs -lucp -lucs并得到了同样的错误)

提前致谢

0 个答案:

没有答案