c++static-librariesnetbeans-7.2boost-signals

c++ Netbeans 7.2.1 linking boost libraries correctly


I've recently switched from visual studio 2010 express to using NetBeans, and i'm already very impressed with the layout and simplicity, even though it did take a bit of nudging to compile right. However, i've got another problem. When i tested to see if boost would work as well, i included the file boost/signals.hpp in a main.cpp and then went to the additional library directories in the project options and added the lib directory of my boost install, same as i would do in visual studio. After all this, i get a bunch of undefined references anyway.

I'm using the mingw compiler with msys and i have boost version 1.47 if that makes any difference. I can confirm that this same install of boost works fine when using visual studio.

Here is the build log.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory m`/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/syncopate5.exe
make[2]: Entering directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
mkdir -p dist/Debug/MinGW-Windows
g++.exe     -o dist/Debug/MinGW-Windows/syncopate5 build/Debug/MinGW-Windows/main.o -L/C/Program\ Files\ \(x86\)/boost/boost_1_47/lib 
build/Debug/MinGW-Windows/main.o: In function `ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_8functionIFvvEEEED2Ev':
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:139: undefined reference to `boost::signals::trackable::~trackable()'
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:139: undefined reference to `boost::signals::detail::signal_base::~signal_base()'
make[2]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:139: undefined reference to `boost::signals::detail::signal_base::~signal_base()'
make[1]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
build/Debug/MinGW-Windows/main.o: In function `ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_8functionIFvvEEEEC2ERKS2_RKS4_':
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:197: undefined reference to `boost::signals::detail::signal_base::signal_base(boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group> const&, boost::any const&)'
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:197: undefined reference to `boost::signals::detail::signal_base::~signal_base()'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/syncopate5.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

Edit:

After trying to add the required lib file manually via the add libraries dialog in the project properties, i receive this error.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/syncopate5.exe
make[2]: Entering directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
make[2]: *** No rule to make target `../../../../../../Program Files \(x86\)/boost/boost_1_47/lib/libboost_signals-vc100-mt-1_47.lib', needed by `dist/Debug/MinGW-Windows/syncopate5.exe'.  Stop.
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
make[1]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'

BUILD FAILED (exit value 2, total time: 9s)

Solution

  • After hours of googling and reading, i have discovered a little more about boost and finally found and understand my problem. When i originally obtained my install of boost, it was from BoostPro which has all the header only objects, as well as precompiled binaries for vc++ ONLY. After obtaining the most recent version of boost, and boost.build to create gcc versions of the libraries and linking against them, it worked without a hitch. Thanks Tyler Jandreau an Joachim Pileborg for answering my inherently flawed question :.