74626

c++ Netbeans 7.2.1 linking boost libraries correctly

Question:

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)

Answer1:

This depends on how you built the project.

If you built the project from an existing makefile, your library paths and libraries should be present in the build environment.

If you built the project by hand by piece-mealing the source, include, and libraries in individually, you will need to <em>explicitly</em> add the libraries that you want.

Specifically, looking at your updated build log, it appears you're not <em>linking</em> the required library and instead added it as a target somehow.

Right click on your project, go to Properties, under the Build tab look toward Linker, Here is where you should specify your link path and your dynamic/static libraries.

Answer2:

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 :.

Recommend

  • How do I run a java application like I would a typical program, using a shortcut?
  • How can I ignore comments statements /*…*/ when i reading java file?
  • Stanford NER Error: Loading distsim lexicon Failed
  • Installing bitarray in Python 2.6 on Windows
  • Git diff is always outputting into less even if it's small or no output
  • Massive fprintf speed difference without “-std=c99”
  • vim-ipython failed on Windows 7
  • Odd VS name mangling behavior?
  • Visual Studio store hidden data in the compiled files?
  • ImportError: No module named 'keras'
  • Where can I download a windows binary of Windres (part of Binutils)?
  • How can I compile C++ code with GCC compiler?
  • Where I can to find C malloc/free source code of implementation for Windows in mingw? [closed]
  • mono --aot with MinGW: unknown pseudo-op: `.local'
  • Configure Eclipse 3.7 with MinGW?
  • Compiling MatConvNet on Windows
  • How to change Python default compiler to GCC?
  • C++ NetBeans Run-Configuration passing arguments-issue
  • C Inline assembly - Operand type mismatch for 'fst'
  • Nested templates workaround for MSVC2010?
  • RXTX gnu.io.PortInUseException: & WARNING: RXTX Version mismatch
  • Clang Cross Compiling for Windows Phone ARM target
  • cmake MSYS Makefiles generator missing
  • Cannot open include file :'stddef.h' No such file or directory found error when creating a
  • Opening an image file from java InputStream
  • Python 2.7 on OS X: TypeError: 'frozenset' object is not callable on each command
  • manupulating a string to create directories in unix
  • How do I compile a C/C++ program through windows command prompt?
  • Using Netbeans with Cygwin and SDL, including SDL.h creates strange error
  • Reading XML into Datatable gives incorrect DateTime when the time has Time Zone info
  • Android mkdirs() sdcard do not work
  • 'doc_del_count' bigger than 'doc_count' on CouchDB
  • c# winform DrawToBitmap offscreen
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • Python 3.2.2, error(scripts to exe)
  • error importing numpy
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Cassandra Data Model
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • How to get NHibernate ISession to cache entity not retrieved by primary key