DrMock
DrMock copied to clipboard
Qt integration tests `UseQt` and `Emit` fail due to linker error on Windows
The exact error (for UseQt
) is:
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\ENTERP~1\VC\Tools\MSVC\1429~1.300\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\UseQtTest.dir\objects1.rsp /out:UseQtTest.exe /implib:UseQtTest.lib /pdb:D:\a\DrMock\DrMock\build\tests\integration\UseQtTest.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console DrMockQtMock.lib ..\..\src\DrMock.lib D:\a\DrMock\Qt\5.15.2\msvc2019_64\lib\Qt5Testd.lib D:\a\DrMock\Qt\5.15.2\msvc2019_64\lib\Qt5Cored.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\UseQtTest.dir/intermediate.manifest CMakeFiles\UseQtTest.dir/manifest.res" failed (exit code 1120) with the following output:
609
UseQtTest.cpp.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const outer::inner::IUseQt::staticMetaObject" (?staticMetaObject@IUseQt@inner@outer@@2UQMetaObject@@B)
610
UseQtTest.exe : fatal error LNK1120: 1 unresolved externals
(Similar for Emit
.) This seems to be a problem with the way MSVC does symbol import/exports (which doesn't work despite CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
):
- https://linux.m2osw.com/unresolved-external-symbol-public-virtual-struct-qmetaobject-const-thiscall-myclassmetaobject
- https://root-forum.cern.ch/t/qtroot-link-problem-of-a-class-derived-from-tqtwidget/14089/5
The Qt integration tests have been disabled, for now. Uncomment in .github/workflows/windows.yml
to reproduce the error.