Can't link program using Boost.Filesystem

前端 未结 5 776
陌清茗
陌清茗 2020-12-06 00:18

I\'m trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn\'t want to build.

#include 
#include 

        
5条回答
  •  庸人自扰
    2020-12-06 00:52

    The solution that worked for me is to compile with "-c" and then create the executable like this:

    g++ -c -o main.o main.cpp
    g++ -o my_prog main.o -lboost_system -lboost_filesystem
    

提交回复
热议问题