Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile fails with VS 2019 and Qt 5.15.2 #4385

Closed
RobertBeckebans opened this issue Nov 28, 2023 · 3 comments
Closed

Compile fails with VS 2019 and Qt 5.15.2 #4385

RobertBeckebans opened this issue Nov 28, 2023 · 3 comments

Comments

@RobertBeckebans
Copy link

System Information

e.g. TrenchBroom master branch on Windows 10

Expected Behavior

I was able to compile TrenchBroom using the master branch any time so far. I haven't tried the latest changes in the recent months but now it fails to compile.

Steps to Reproduce

  1. I use this .bat file to generate the solution:
del /s /q build
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2015_64" ..
pause
  1. Then I load build/TrenchBroom.sln with VS 2019 Community Edition and hit Build Solution (F7)

Crash Info

This is the compile log:

Build started...
1>------ Build started: Project: generate_version, Configuration: Debug x64 ------
1>-- Using version description "v2023.1-386-g033e343fe" from git describe
2>------ Build started: Project: dump-shortcuts, Configuration: Debug x64 ------
3>------ Build started: Project: common-benchmark, Configuration: Debug x64 ------
4>------ Build started: Project: TrenchBroom-nomanual, Configuration: Debug x64 ------
5>------ Build started: Project: common-regression-test, Configuration: Debug x64 ------
6>------ Build started: Project: common-test, Configuration: Debug x64 ------
2>Automatic MOC for target dump-shortcuts
5>Automatic MOC for target common-regression-test
3>Automatic MOC for target common-benchmark
6>Automatic MOC for target common-test
2>TrenchBroomApp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QTimer::start(class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (__imp_?start@QTimer@@QEAAXV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@std@@@Z) referenced in function "public: __cdecl TrenchBroom::View::TrenchBroomApp::TrenchBroomApp(int &,char * *)" (??0TrenchBroomApp@View@TrenchBroom@@QEAA@AEAHPEAPEAD@Z)
3>TrenchBroomApp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QTimer::start(class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (__imp_?start@QTimer@@QEAAXV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@std@@@Z) referenced in function "public: __cdecl TrenchBroom::View::TrenchBroomApp::TrenchBroomApp(int &,char * *)" (??0TrenchBroomApp@View@TrenchBroom@@QEAA@AEAHPEAPEAD@Z)
2>  Hint on symbols that are defined and could potentially match:
2>    "__declspec(dllimport) public: void __cdecl QAbstractAnimation::start(enum QAbstractAnimation::DeletionPolicy)" (__imp_?start@QAbstractAnimation@@QEAAXW4DeletionPolicy@1@@Z)
3>  Hint on symbols that are defined and could potentially match:
2>    "__declspec(dllimport) public: void __cdecl QElapsedTimer::start(void)" (__imp_?start@QElapsedTimer@@QEAAXXZ)
2>    "__declspec(dllimport) public: void __cdecl QProcess::start(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (__imp_?start@QProcess@@QEAAXAEBVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
2>    "__declspec(dllimport) public: void __cdecl QTimer::start(int)" (__imp_?start@QTimer@@QEAAXH@Z)
2>X:\Projects_Quake1\TrenchBroom4\build\dump-shortcuts\Debug\dump-shortcuts.exe : fatal error LNK1120: 1 unresolved externals
3>    "__declspec(dllimport) public: void __cdecl QAbstractAnimation::start(enum QAbstractAnimation::DeletionPolicy)" (__imp_?start@QAbstractAnimation@@QEAAXW4DeletionPolicy@1@@Z)
3>    "__declspec(dllimport) public: void __cdecl QElapsedTimer::start(void)" (__imp_?start@QElapsedTimer@@QEAAXXZ)
3>    "__declspec(dllimport) public: void __cdecl QProcess::start(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (__imp_?start@QProcess@@QEAAXAEBVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
3>    "__declspec(dllimport) public: void __cdecl QTimer::start(int)" (__imp_?start@QTimer@@QEAAXH@Z)
3>X:\Projects_Quake1\TrenchBroom4\build\common\benchmark\Debug\common-benchmark.exe : fatal error LNK1120: 1 unresolved externals
5>TrenchBroomApp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QTimer::start(class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (__imp_?start@QTimer@@QEAAXV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@std@@@Z) referenced in function "public: __cdecl TrenchBroom::View::TrenchBroomApp::TrenchBroomApp(int &,char * *)" (??0TrenchBroomApp@View@TrenchBroom@@QEAA@AEAHPEAPEAD@Z)
4>TrenchBroomApp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QTimer::start(class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (__imp_?start@QTimer@@QEAAXV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@std@@@Z) referenced in function "public: __cdecl TrenchBroom::View::TrenchBroomApp::TrenchBroomApp(int &,char * *)" (??0TrenchBroomApp@View@TrenchBroom@@QEAA@AEAHPEAPEAD@Z)
5>  Hint on symbols that are defined and could potentially match:
4>  Hint on symbols that are defined and could potentially match:
5>    "__declspec(dllimport) public: void __cdecl QAbstractAnimation::start(enum QAbstractAnimation::DeletionPolicy)" (__imp_?start@QAbstractAnimation@@QEAAXW4DeletionPolicy@1@@Z)
5>    "__declspec(dllimport) public: void __cdecl QElapsedTimer::start(void)" (__imp_?start@QElapsedTimer@@QEAAXXZ)
5>    "__declspec(dllimport) public: void __cdecl QProcess::start(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (__imp_?start@QProcess@@QEAAXAEBVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
5>    "__declspec(dllimport) public: void __cdecl QTimer::start(int)" (__imp_?start@QTimer@@QEAAXH@Z)
5>X:\Projects_Quake1\TrenchBroom4\build\common\test\Debug\common-regression-test.exe : fatal error LNK1120: 1 unresolved externals
4>    "__declspec(dllimport) public: void __cdecl QAbstractAnimation::start(enum QAbstractAnimation::DeletionPolicy)" (__imp_?start@QAbstractAnimation@@QEAAXW4DeletionPolicy@1@@Z)
4>    "__declspec(dllimport) public: void __cdecl QElapsedTimer::start(void)" (__imp_?start@QElapsedTimer@@QEAAXXZ)
4>    "__declspec(dllimport) public: void __cdecl QProcess::start(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (__imp_?start@QProcess@@QEAAXAEBVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
4>    "__declspec(dllimport) public: void __cdecl QTimer::start(int)" (__imp_?start@QTimer@@QEAAXH@Z)
4>X:\Projects_Quake1\TrenchBroom4\build\app\Debug\TrenchBroom-nomanual.exe : fatal error LNK1120: 1 unresolved externals
2>Done building project "dump-shortcuts.vcxproj" -- FAILED.
7>------ Build started: Project: GenerateManual, Configuration: Debug x64 ------
4>Done building project "TrenchBroom-nomanual.vcxproj" -- FAILED.
3>Done building project "common-benchmark.vcxproj" -- FAILED.
5>Done building project "common-regression-test.vcxproj" -- FAILED.
7>Generating gen-manual/shortcuts.js
7>'..\dump-shortcuts\Debug\dump-shortcuts.exe' is not recognized as an internal or external command,
7>operable program or batch file.
7>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'X:\Projects_Quake1\TrenchBroom4\build\CMakeFiles\5c1ef1404705f3057dc0da539c335ca0\shortcuts.js.rule;X:\Projects_Quake1\TrenchBroom4\build\CMakeFiles\0abc789af969ff3d95abd789cf333e16\GenerateManual.rule' exited with code 9009.
7>Done building project "GenerateManual.vcxproj" -- FAILED.
8>------ Build started: Project: TrenchBroom, Configuration: Debug x64 ------
8>TrenchBroomApp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QTimer::start(class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (__imp_?start@QTimer@@QEAAXV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@std@@@Z) referenced in function "public: __cdecl TrenchBroom::View::TrenchBroomApp::TrenchBroomApp(int &,char * *)" (??0TrenchBroomApp@View@TrenchBroom@@QEAA@AEAHPEAPEAD@Z)
6>TrenchBroomApp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QTimer::start(class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (__imp_?start@QTimer@@QEAAXV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@std@@@Z) referenced in function "public: __cdecl TrenchBroom::View::TrenchBroomApp::TrenchBroomApp(int &,char * *)" (??0TrenchBroomApp@View@TrenchBroom@@QEAA@AEAHPEAPEAD@Z)
8>  Hint on symbols that are defined and could potentially match:
8>    "__declspec(dllimport) public: void __cdecl QAbstractAnimation::start(enum QAbstractAnimation::DeletionPolicy)" (__imp_?start@QAbstractAnimation@@QEAAXW4DeletionPolicy@1@@Z)
8>    "__declspec(dllimport) public: void __cdecl QElapsedTimer::start(void)" (__imp_?start@QElapsedTimer@@QEAAXXZ)
8>    "__declspec(dllimport) public: void __cdecl QProcess::start(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (__imp_?start@QProcess@@QEAAXAEBVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
8>    "__declspec(dllimport) public: void __cdecl QTimer::start(int)" (__imp_?start@QTimer@@QEAAXH@Z)
8>X:\Projects_Quake1\TrenchBroom4\build\app\Debug\TrenchBroom.exe : fatal error LNK1120: 1 unresolved externals
6>  Hint on symbols that are defined and could potentially match:
6>    "__declspec(dllimport) public: void __cdecl QAbstractAnimation::start(enum QAbstractAnimation::DeletionPolicy)" (__imp_?start@QAbstractAnimation@@QEAAXW4DeletionPolicy@1@@Z)
6>    "__declspec(dllimport) public: void __cdecl QElapsedTimer::start(void)" (__imp_?start@QElapsedTimer@@QEAAXXZ)
6>    "__declspec(dllimport) public: void __cdecl QProcess::start(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (__imp_?start@QProcess@@QEAAXAEBVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
6>    "__declspec(dllimport) public: void __cdecl QTimer::start(int)" (__imp_?start@QTimer@@QEAAXH@Z)
6>X:\Projects_Quake1\TrenchBroom4\build\common\test\Debug\common-test.exe : fatal error LNK1120: 1 unresolved externals
8>Done building project "TrenchBroom.vcxproj" -- FAILED.
6>Done building project "common-test.vcxproj" -- FAILED.
9>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
9>Project not selected to build for this solution configuration 
10>------ Skipped Build: Project: PACKAGE, Configuration: Debug x64 ------
10>Project not selected to build for this solution configuration 
========== Build: 1 succeeded, 7 failed, 8 up-to-date, 2 skipped ==========

Thank you very much!

@alexkiri
Copy link
Contributor

You have the incorrect qt path. You can also try adding the -T parameter like this:

cmake .. -G "Visual Studio 16 2019" -T v142 -A x64 -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64"

It even works with VS2022. This is what works for me:
cmake .. -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64"

@kduske
Copy link
Collaborator

kduske commented Nov 28, 2023

you can also compare your script to our ci setup, that should work.

@kduske kduske closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2023
@RobertBeckebans
Copy link
Author

Thanks @alexkiri that was it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants