c++boostlinkermlpack

Boost_program_option linker error even "boost_program_options" exist


I have defined boost_program_options in qmake file .

> CONFIG(debug, debug|release) {
>     LIBS += -L"C:\boost_1_55_0\stage\lib" -lboost_program_options-mgw48-mt-d-1_55 -lboost_system-mgw48-mt-d-1_55 -lboost_thread-mgw48-mt-d-1_55 }

 CONFIG(release, debug|release) {
>     LIBS += -L"C:\boost_1_55_0\stage\lib" -lboost_program_options-mgw48-mt-1_55 -lboost_system-mgw48-mt-1_55 -lboost_thread-mgw48-mt-1_55 }

I want to use a library which called mlpack . And compiled it with the help of mingw. When I add

"#include <mlpack/core.hpp>"

I am having tones of linker errors( I am pasting a few for ease of read. ):

C:/Qt/Tools/QtCreator/bin/aubioSecond/libs//libmlpack.a(cli.cpp.obj):cli.cpp:(.text+0x3ed): undefined reference to `boost::program_options::options_description::m_default_line_length' 

C:/Qt/Tools/QtCreator/bin/aubioSecond/libs//libmlpack.a(cli.cpp.obj):cli.cpp:(.text+0x41e): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' 

C:/Qt/Tools/QtCreator/bin/aubioSecond/libs//libmlpack.a(cli.cpp.obj):cli.cpp:(.text+0x43b): undefined reference to `boost::program_options::variables_map::variables_map()'

C:/Qt/Tools/QtCreator/bin/aubioSecond/libs//libmlpack.a(cli.cpp.obj):cli.cpp:(.text+0x486a): undefined reference to `boost::program_options::notify(boost::program_options::variables_map&)' 

c:/qt/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: 

C:/Qt/Tools/QtCreator/bin/aubioSecond/libs//libmlpack.a(cli.cpp.obj): bad reloc address 0x2 in section `.text$_ZN5boost16exception_detail10clone_baseD1Ev[__ZN5boost16exception_detail10clone_baseD1Ev]'

If anyone has a idea why I am having this problem I will be very thankfull.

Regards


Solution

  • Gilles Barges reports on the mlpack mailing list that the linking error with boost_program_options can be resolved by modifying CMakeLists.txt, line 189, commenting out the bit

    set(Boost_LIBRARIES "")
    

    See the mailing list post for more information:

    https://mailman.cc.gatech.edu/pipermail/mlpack/2014-August/000488.html