【发布时间】:2019-09-19 05:07:04
【问题描述】:
Windows 7 x86、cmake 版本 3.15.2、4.10 qtcreator、Qt5.12.4 MinGW。我用两个库构建了一个项目,在其中一个库中我从另一个库中调用一个类。结果,我得到一个错误。
...file2.cpp:-1: ошибка: undefined reference to `MyClass1::MyClass1()'
collect2.exe:-1: ошибка: error: ld returned 1 exit status
[ 91%] Linking CXX executable flasher.exe
lib2/liblib2.a(file2.cpp.obj):file2.cpp:(.text+0x18): undefined reference to `MyClass1::MyClass1()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [CMakeFiles\my.dir\build.make:107: flasher.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:83: CMakeFiles/my.dir/all] Error 2
mingw32-make.exe: *** [Makefile:83: all] Error 2
最小可重现示例:githab.com Src。
【问题讨论】:
-
在 Stack Overflow 上,我们希望 minimal reproducible example在问题帖子中,而不是链接。
标签: windows qt cmake qt-creator