我正在尝试将 MLPACK 与我在 Qt Creator 中的项目集成(使用 MinGW 作为编译器)并且我不断收到与 LAPACK 和 Armadillo 相关的链接错误。我自己编译了 LAPACK 和 BLAS 并运行了一个测试脚本,那里的一切似乎都很好。此外,我使用启用了 LAPACK 和 BLAS 的 CMake-gui 编译了 Armadillo(没有包装器),并且 example1.cpp 编译并运行没有问题。MLPACK 编译并找到所有需要的依赖项。
我的 .pro 文件具有以下内容:
## Armadillo
INCLUDEPATH += $$PWD/MLPACK/dependencies/armadillo/include
## LAPACK
unix|win32: LIBS += -L$$PWD/MLPACK/dependencies/lapack/ -llapack
## BLAS
unix|win32: LIBS += -L$$PWD/MLPACK/dependencies/blas/ -lblas
## LibXML2
unix|win32: LIBS += -L$$PWD/MLPACK/dependencies/libxml2/lib/ -lxml2
INCLUDEPATH += $$PWD/MLPACK/dependencies/libxml2/include
DEPENDPATH += $$PWD/MLPACK/dependencies/libxml2/include
unix|win32-g++: PRE_TARGETDEPS += $$PWD/MLPACK/dependencies/libxml2/lib/libxml2.a
## Boost
unix|win32: LIBS += -L$$PWD/../../boost_1_54_0/stage/lib/ -lboost_program_options-mgw48-mt-1_54
INCLUDEPATH += $$PWD/../../boost_1_54_0
DEPENDPATH += $$PWD/../../boost_1_54_0
unix|win32-g++: PRE_TARGETDEPS += $$PWD/../../boost_1_54_0/stage/lib/libboost_program_options-mgw48-mt-1_54.a
unix|win32: LIBS += -L$$PWD/../../boost_1_54_0/stage/lib/ -lboost_random-mgw48-mt-1_54
unix|win32-g++: PRE_TARGETDEPS += $$PWD/../../boost_1_54_0/stage/lib/libboost_random-mgw48-mt-1_54.a
unix|win32: LIBS += -L$$PWD/../../boost_1_54_0/stage/lib/ -lboost_unit_test_framework-mgw48-mt-1_54
unix|win32-g++: PRE_TARGETDEPS += $$PWD/../../boost_1_54_0/stage/lib/libboost_unit_test_framework-mgw48-mt-1_54.a
## MLPACK
unix|win32: LIBS += -L$$PWD/MLPACK/lib/ -lmlpack
INCLUDEPATH += $$PWD/MLPACK/include
DEPENDPATH += $$PWD/MLPACK/include
unix|win32-g++: PRE_TARGETDEPS += $$PWD/MLPACK/lib/libmlpack.a
当我编译我的项目时,我得到了这个:
C:/Workspace/OffLineSorter/MLPACK/lib//libmlpack.a(pca.cpp.obj):pca.cpp:(.text$_ZN4arma6auxlib11svd_dc_econIdNS_3MatIdEEEEbRNS2_IT_EERNS_3ColIS4_EES6_RKNS_4BaseIS4_T0_EE[__ZN4arma6auxlib11svd_dc_econIdNS_3MatIdEEEEbRNS2_IT_EERNS_3ColIS4_EES6_RKNS_4BaseIS4_T0_EE]+0x24f): undefined reference to `dgesdd_'
Makefile.Debug:252: recipe for target 'debug\OffLineSorter.exe' failed
C:/Workspace/OffLineSorter/MLPACK/lib//libmlpack.a(pca.cpp.obj):pca.cpp:(.text$_ZN4arma6auxlib8svd_econIdNS_3MatIdEEEEbRNS2_IT_EERNS_3ColIS4_EES6_RKNS_4BaseIS4_T0_EEc[__ZN4arma6auxlib8svd_econIdNS_3MatIdEEEEbRNS2_IT_EERNS_3ColIS4_EES6_RKNS_4BaseIS4_T0_EEc]+0x286): undefined reference to `dgesvd_'
C:/Qt/Qt5.3.0/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: C:/Workspace/OffLineSorter/MLPACK/lib//libmlpack.a(pca.cpp.obj): bad reloc address 0x286 in section `.text$_ZN4arma6auxlib8svd_econIdNS_3MatIdEEEEbRNS2_IT_EERNS_3ColIS4_EES6_RKNS_4BaseIS4_T0_EEc[__ZN4arma6auxlib8svd_econIdNS_3MatIdEEEEbRNS2_IT_EERNS_3ColIS4_EES6_RKNS_4BaseIS4_T0_EEc]'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [debug\OffLineSorter.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/Workspace/build-OffLineSorter-Desktop_Qt_5_3_0_MinGW_32bit-Debug'
mingw32-make: *** [debug] Error 2
Makefile:34: recipe for target 'debug' failed
关于我可能做错了什么的任何想法?谢谢你的帮助!