How to link boost libraries properly in Linux

前端 未结 2 1693
死守一世寂寞
死守一世寂寞 2021-02-08 20:37

I\'ve been trying to go through Boost tutorials but I got stuck at linking the filesystem library.

I have Ubuntu 12.10. Installation wasn\'t that hard

su         


        
2条回答
  •  星月不相逢
    2021-02-08 21:30

    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, that was 1 problem.

提交回复
热议问题