作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们有一些困惑的 makefile 系统,我们将对其进行修复。但与此同时,我需要添加一个解决方法,如果您可以要求编译器(或链接器)链接一个库,我正在徘徊,但前提是它存在。我知道如何修复 makefile,但这需要一些时间,同时我想快速破解...
所以我有这样的东西:
gcc <...other options...> -L ./some/path -l somelibrary
当 libsomelibrary.so
不存在这会产生错误。我希望它在这种情况下继续而不链接。那可能吗? - 一些链接器选项?
最佳答案
可以替换
gcc <...other options...> -L ./some/path -l somelibrary
在生成文件中
gcc <...other options...> -L ./some/path -l somelibrary || gcc <...other options...> -Wl,--unresolved-symbols=ignore-in-object-files
作为旁注,而不是 -L ./some/path -l somelibrary
你可以简单地做 ./some/path/libsomelibrary.so
.
关于c++ - 使用 gcc 是否可以链接库,但前提是它存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53085524/
我是一名优秀的程序员,十分优秀!