Thread: undefined reference to `boost::filesystem::

  1. #1
    Registered User
    Join Date
    May 2019
    Posts
    2

    undefined reference to `boost::filesystem::

    Hello all,

    I downloaded and complete the boost library run the ./ bootstrap.sh and
    ./b2 the I linked the /usr/local/lib/ and /usr/local/include

    but still get the following error
    Code:
     g++ -o test testMain.cpp -lboost_system -lboost_date_time -lboost_thread 
    /tmp/ccSDskyT.o: In function `boost::filesystem::create_directory(boost::filesystem::path const&)':
    testMain.cpp:(.text._ZN5boost10filesystem16create_directoryERKNS0_4pathE[_ZN5boost10filesystem16create_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code*)'
    collect2: error: ld returned 1 exit status
    thank you for your help

    Best regrads Chris

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,248
    You may want to try -lboost_filesystem in addition to what you already have.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2019
    Posts
    2

    Thanks

    Quote Originally Posted by laserlight View Post
    You may want to try -lboost_filesystem in addition to what you already have.
    Thank you

    Where did you get the information about that,
    I havent found really good materials How to make a Makefile
    Where did you learn that ?

    thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 01-13-2010, 07:35 AM
  2. Replies: 2
    Last Post: 12-12-2007, 06:45 AM
  3. <errno> and boost::filesystem
    By Mario F. in forum C++ Programming
    Replies: 0
    Last Post: 06-12-2007, 10:36 AM
  4. boost, xtime_get: undefined reference
    By Raven Arkadon in forum C++ Programming
    Replies: 2
    Last Post: 08-09-2006, 09:28 AM
  5. boost::filesystem - relative paths
    By azteched in forum C++ Programming
    Replies: 2
    Last Post: 03-05-2005, 06:24 AM

Tags for this Thread