MSYS2(64位):使用cmake构建时无法链接头文件和库

时间:2019-08-12 20:17:13

标签: makefile build cmake linker

我对在Windows中构建还是很陌生。我正在构建以下项目:https://github.com/arkottke/strata

该页面建议使用MSYS2安装依赖项。我已经按照说明安装了MSYS2并安装了所有内容,但是在尝试使用cmake和/或make(?)进行构建时得到以下内容(缩写):

$> git clone https://github.com/arkottke/strata.git
$> cd strata
$> mkdir build
$> cd build
$> cmake .. -DCMAKE_BUILD_TYPE=Release
$> make -j2
[  1%] Automatic MOC for target strata
[  1%] Built target strata_autogen
[  2%] Linking CXX executable strata.exe
CMakeFiles/strata.dir/strata_autogen/mocs_compilation.cpp.o:mocs_compilation.cpp:(.text$_ZN12CrustalModelD0Ev[_ZN12CrustalModelD0Ev]+0x8f): undefined reference to `QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
CMakeFiles/strata.dir/strata_autogen/mocs_compilation.cpp.o:mocs_compilation.cpp:(.text$_ZN12CrustalModelD0Ev[_ZN12CrustalModelD0Ev]+0x8f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
CMakeFiles/strata.dir/strata_autogen/mocs_compilation.cpp.o:mocs_compilation.cpp:(.text$_ZN12CrustalModelD0Ev[_ZN12CrustalModelD0Ev]+0xaa): undefined reference to `QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
CMakeFiles/strata.dir/strata_autogen/mocs_compilation.cpp.o:mocs_compilation.cpp:(.text$_ZN12CrustalModelD0Ev[_ZN12CrustalModelD0Ev]+0xaa): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
CMakeFiles/strata.dir/strata_autogen/mocs_compilation.cpp.o:mocs_compilation.cpp:(.text$_ZN12CrustalModelD0Ev[_ZN12CrustalModelD0Ev]+0xc5): undefined reference to `QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
collect2: error: ld returned 1 exit status
make[2]: *** [source/CMakeFiles/strata.dir/build.make:2225: source/strata.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:119: source/CMakeFiles/strata.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

根据GitHub页面,此链接错误很常见,可以解决:“如果构建无法找到要链接的头文件和库,则可以通过修改strata.pro文本文件来添加这些文件的路径。 ,或者通过传递INCLUDEPATH和LIBS环境变量...在Windows上,PATH应该包括Qwt和GSL DLL文件的路径。“

如果任何人都可以通过简单的步骤来解释此建议,将再次受到赞赏。

谢谢

0 个答案:

没有答案