Can't link program using Boost.Filesystem

前端 未结 5 782
陌清茗
陌清茗 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:30

    For some boost modules, you have to compile libraries and link them (using bootstrap.sh). In your case, you have to compile and link Filesystem, and probalbly System too

    Have a look here

    For example:

    • ./bootstrap.sh (bjam)
    • rm -rf bin.v2 stage (between 2 bjam commands)
    • ./bjam release toolset=gcc address-model=64 cxxflags=-fPIC
    • ./bjam debug toolset=gcc address-model=64 cxxflags=-fPIC

    If you are linking on Windows, you don't have to manually link your libraries, since they are automatically linked using pragma. On Linux, you have to do it.

    According to documentation, these modules need you to acquire or build a library :

    • Boost.Filesystem
    • Boost.GraphParallel
    • Boost.IOStreams
    • Boost.MPI
    • Boost.ProgramOptions
    • Boost.Python
    • Boost.Regex
    • Boost.Serialization
    • Boost.Signals
    • Boost.System
    • Boost.Thread
    • Boost.Wave

提交回复
热议问题