使用g+的静态链路增强+;关于马科斯 我用FLTK工具包在C++中构建了一个项目,并且包含了序列化的升压库,并且希望静态链接到它们,因为我不能保证其他机器上存在Boost库。
我重新运行了boost下载中的安装命令,如下所示:使用g+的静态链路增强+;关于马科斯 我用FLTK工具包在C++中构建了一个项目,并且包含了序列化的升压库,并且希望静态链接到它们,因为我不能保证其他机器上存在Boost库。,c++,boost,static,g++,static-linking,C++,Boost,Static,G++,Static Linking,我重新运行了boost下载中的安装命令,如下所示: sudo ./b2 link=static sudo ./b2 install link=static 然后我就这样编译我的项目 g++ `fltk-config --use-forms --use-gl --use-images --ldflags --cxxflags` xxxx.cpp -L/opt/local/lib/ -Wl, -Bstatic -lboost_iostreams -lboost_serialization -Wl
sudo ./b2 link=static
sudo ./b2 install link=static
然后我就这样编译我的项目
g++ `fltk-config --use-forms --use-gl --use-images --ldflags --cxxflags` xxxx.cpp -L/opt/local/lib/ -Wl, -Bstatic -lboost_iostreams -lboost_serialization -Wl, -Bdynamic -o program_name
但是如果失败了,就把它作为输出
ld: file not found:
collect2: ld returned 1 exit status
我真的不知道该怎么办,有人有什么指导吗?您在
-Wl,-Bstatic
中有一个空格。删除该空间,例如-Wl,-Bstatic
这同样适用于
-Wl,-Bdynamic
将-v(或--v)添加到命令行以获取更多信息。您的启动库是否在/opt/local/lib中?不确定,为什么命令行参数有严重的口音?很好,但仍然不起作用。我也遵循了这里的建议,通过macports安装了我能想到的所有东西,现在使用此命令进行编译“g++-mp-4.7fltk配置——使用表单——使用gl——使用图像——ldflags——cxflags
xxxx.cppfltk配置——ldflags
-L/opt/local/lib/-Wl,-Bstatic-lboost\u iostreams-lboost\u序列化-Wl,-b动态-o程序名“但它仍然返回以下错误:ld:unknown option:-Bstatic collect2:error:ld返回了1个退出状态。”