[SOLVED] Problem linking boost_filesystem on Mac OSX
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*
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.
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.
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. :)