开发者

Linux cc compilation of library in directory within project?

开发者 https://www.devze.com 2022-12-26 07:18 出处:网络
My directo开发者_运维技巧ry structure looks like the following: -xmllib -libxml++-1.0.a -main.cc ..and I issue the command:

My directo开发者_运维技巧ry structure looks like the following:

-xmllib
    -libxml++-1.0.a
-main.cc

..and I issue the command:

cc -lstdc++ -L./xmllib -llibxml++-1.0.a main.cc

But then it tells me that it can't find the binary for the library...even though I issued the command from the root directory.

/usr/bin/ld: cannot find -llibxml++-1.0.a main.cc
collect2: ld returned 1 exit status

Is there any reason why cc can't find the binary library?

I'm using cc version 2.96 (yes, it's old).


Change this:

-llibxml++-1.0.a

to this:

-lxml++-1.0

On Posix, the linker's -l option wants neither the lib prefix or the .a extension.

0

精彩评论

暂无评论...
验证码 换一张
取 消