Linux cc 项目内目录中的库编译?

发布于 2024-08-28 23:29:15 字数 387 浏览 0 评论 0原文

我的目录结构如下所示:

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

..并且我发出命令:

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

但它告诉我它找不到库的二进制文件...即使我从根目录发出命令。

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

cc找不到二进制库有什么原因吗?

我使用的是 cc 版本 2.96(是的,它很旧)。

My directory 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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尾戒 2024-09-04 23:29:15

将其更改

-llibxml++-1.0.a

-lxml++-1.0

:在 Posix 上,链接器的 -l 选项既不需要 lib 前缀,也不需要 .a 扩展名。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文