0

我在 qmake 文件中定义了 boost_program_options 。

> 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 }

我想使用一个名为 mlpack 的库。并在mingw的帮助下编译。当我添加

"#include <mlpack/core.hpp>"

我有一些链接器错误(为了便于阅读,我粘贴了一些。):

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]'

如果有人知道我为什么会遇到这个问题,我将非常感激。

问候

4

1 回答 1

1

Gilles Barges 在 mlpack 邮件列表中报告说,与 boost_program_options 的链接错误可以通过修改 CMakeLists.txt,第 189 行,注释掉该位来解决

set(Boost_LIBRARIES "")

有关更多信息,请参阅邮件列表帖子:

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

于 2014-09-15T19:35:33.453 回答