【发布时间】:2014-03-21 13:41:28
【问题描述】:
我正在使用 FLTK 工具包在 C++ 中构建一个项目,并包含用于序列化的 boost 库,并且希望静态链接到它们,因为我不能保证 boost 库在其他机器上的存在。
我从 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, -Bdynamic -o program_name
但是失败了,这只是一个输出
ld: file not found:
collect2: ld returned 1 exit status
我不太确定在这里做什么,有人有什么指导吗?
【问题讨论】:
-
将 -v(或 --v)添加到命令行以获取更多信息。您的引导库在 /opt/local/lib 中吗?不确定,为什么命令行参数是重音?
标签: c++ boost static g++ static-linking