How to statically link libstdc++(如何静态链接 libstdc++)
问题描述
我试图让我的程序在另一台 libstdc++ 版本不同的机器上运行.我正在netbeans上开发和编译它.我已指定选项 -static-libstdc++ 但程序继续尝试在本地机器中加载 libstdc++.so.6.
I am trying to get my program working in another machine where libstdc++ versions is different. I am developing and compiling it on netbeans. I have specified the option -static-libstdc++ but the program continues trying to load libstdc++.so.6 in the local machine.
如何获得完全静态的 libstdc++ 链接?
How can I get a fully static libstdc++ link?
谢谢.
推荐答案
我不确定这里的确切情况,但我刚刚在不同版本的 Mac OS X 和 gcc 中遇到了类似的问题.我通过将我想要的实际 dylib 复制到与可执行文件相同的目录中并更改 DYLD_LIBRARY_PATH 使其在/usr/lib 之前首先在那里搜索来解决它.
Not sure of the exact circumstances here, but I ran into a similar problem just now with different versions of Mac OS X and gcc. I worked around it by copying the actual dylib I wanted into the same directory as the executable and changing DYLD_LIBRARY_PATH to have it search there first before /usr/lib.
这篇关于如何静态链接 libstdc++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何静态链接 libstdc++
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
