且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Linux中正确链接Boost库

更新时间:2023-02-25 13:29:51

我在这里找到了答案:
http://www.richelbilderbeek.nl/CppLinkErrorUndefinedReferenceToBoostFilesystemDetailGet_current_path_api.htm
看起来二进制文件不在/usr/lib中,而在/usr/local/lib中.
因此,正确的编译命令将是:

I found the answer myself here:
http://www.richelbilderbeek.nl/CppLinkErrorUndefinedReferenceToBoostFilesystemDetailGet_current_path_api.htm
Looks like binaries weren't in /usr/lib but in /usr/local/lib.
So the correct command for compilation would be:

g++ -g tut1.cpp -o tut1 -L/usr/local/lib/ -lboost_filesystem

@Yuushi,那是1个问题.

@Yuus that was 1 problem.