Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Problem linking boost_filesystem on Mac OSX
Forum Update on Monday, May 27th 2025

[SOLVED] Problem linking boost_filesystem on Mac OSX

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 6.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mkae
    wrote on 25 Sept 2012, 06:45 last edited by
    #1

    Hi,

    I have tried to compile the "boost_filesystem example program":http://www.boost.org/doc/libs/1_51_0/libs/filesystem/example/tut4.cpp with the following qmake configuration
    @QT -= core
    QT -= gui
    CONFIG += console
    CONFIG -= app_bundle
    INCLUDEPATH += /opt/macports-test
    LIBS += -L/opt/macports-test/lib -lboost_filesystem
    SOURCES += main.cpp
    @

    Compiling poses no problem, but LINKING DOES :-(
    as one can see here:
    @08:39:51: Running steps for project filesystem...
    08:39:51: Starting: "/usr/bin/make" -w
    make: Entering directory /Users/marko/WC/client_server/boost/filesystem-build-desktop-Version_4_Release' /usr/bin/g++-4.2 -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.6 -o filesystem main.o -L/opt/macports-test/lib -lboost_filesystem Undefined symbols: "boost::system::system_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o "boost::system::generic_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o __static_initialization_and_destruction_0(int, int)in main.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [filesystem] Error 1 make: Leaving directory /Users/marko/WC/client_server/boost/filesystem-build-desktop-Version_4_Release'
    08:39:51: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project filesystem (target: Desktop)
    When executing step 'Make'
    @

    The libraries are to be found where I tell qmake
    @
    $ ls -1 /opt/macports-test/lib/libboost_filesystem*
    /opt/macports-test/lib/libboost_filesystem-d.a
    /opt/macports-test/lib/libboost_filesystem-d.dylib
    /opt/macports-test/lib/libboost_filesystem-mt-d.a
    /opt/macports-test/lib/libboost_filesystem-mt-d.dylib
    /opt/macports-test/lib/libboost_filesystem-mt.a
    /opt/macports-test/lib/libboost_filesystem-mt.dylib
    /opt/macports-test/lib/libboost_filesystem.a
    /opt/macports-test/lib/libboost_filesystem.dylib
    @

    So, I wonder where my - presumable simple - mistake is hidden...

    I am using boost 1.50.0 installed through "MacPorts":http://www.macports.org and the qt-creator 2.5.0 installed using the official dmg from Nokia.

    Greets,
    Marko

    1 Reply Last reply
    0
    • U Offline
      U Offline
      uranusjr
      wrote on 25 Sept 2012, 13:42 last edited by
      #2

      From "this":http://forums.macrumors.com/showthread.php?t=290098&page=2 MacRumors thread.

      It seems like you need to link to boost_system as well as boost_filesystem.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mkae
        wrote on 25 Sept 2012, 16:27 last edited by
        #3

        OMG, I'd have never found this myself. Thanks for the hint. Indeed, when I use
        @LIBS += -L/opt/macports-test/lib -lboost_system -lboost_filesystem@
        all works just fine. :)

        1 Reply Last reply
        0

        1/3

        25 Sept 2012, 06:45

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved