Error with CMake and VS2019

cmake D:\temp\Krs\VCMI/source -DCMAKE_TOOLCHAIN_FILE=D:\temp\Krs\VCMI/vcpkg/scripts/buildsystems/vcpkg.cmake -G “Visual Studio 16 2019” -A x64

gives me the following error:

– Could NOT find luajit (missing: luajit_LIBRARY) (found version “”)
– Cannot find LuaJIT! Fallback to using usual Lua.
tbb: D:/temp/Krs/VCMI/vcpkg/installed/x64-windows/bin/tbb.dll
fuzzylite: D:/temp/Krs/VCMI/vcpkg/installed/x64-windows/bin/fuzzylite.dll
CMake Error at cmake_modules/VCMIUtils.cmake:130 (get_target_property):
get_target_property() called with non-existent target “luajit::luajit”.
Call Stack (most recent call first):
osx/CMakeLists.txt:77 (install_vcpkg_imported_tgt)

– Configuring incomplete, errors occurred!

I have tried removing → reinstalling luajit but the problem is still there. Can someone help with an advice?

Do you use prebuilt vcpkg or your own? It might be possible to disable LUA as well

pass this to the cmake invocation:

-D ENABLE_ERM=OFF -D ENABLE_LUA=OFF

Ok ty. That got me further, but still one lib is missing…
minizip.lib and zlib.lib seem to be in the right folders.

2>------ Build started: Project: VCMI_lib, Configuration: Release x64 ------
2>   Creating library D:/temp/Krs/VCMI/build/bin/Release/VCMI_lib.lib and object D:/temp/Krs/VCMI/build/bin/Release/VCMI_lib.exp
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzOpen2_64 referenced in function "public: __cdecl CZipStream::CZipStream(class std::shared_ptr<class CIOApi>,class boost::filesystem::path const &,struct unz64_file_pos_s)" ([email protected]@[email protected][email protected]@@@[email protected]@[email protected]@[email protected]@[email protected]@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzClose referenced in function "public: __cdecl vstd::ScopeGuard<class <lambda_0cdc06d00699876ee6a3f613ee9f1d3e> >::~ScopeGuard<class <lambda_0cdc06d00699876ee6a3f613ee9f1d3e> >(void)" ([email protected]<lambda_0cdc06d00699876ee6a3f613ee9f1d3e>@@@[email protected]@[email protected])
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzGoToFirstFile referenced in function "private: class std::unordered_map<class ResourceID,struct unz64_file_pos_s,struct std::hash<class ResourceID>,struct std::equal_to<class ResourceID>,class std::allocator<struct std::pair<class ResourceID const ,struct unz64_file_pos_s> > > __cdecl CZipLoader::listFiles(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::filesystem::path const &)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@@[email protected]@[email protected]@@@[email protected][email protected][email protected][email protected]@[email protected]@@[email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzGoToNextFile referenced in function "private: class std::unordered_map<class ResourceID,struct unz64_file_pos_s,struct std::hash<class ResourceID>,struct std::equal_to<class ResourceID>,class std::allocator<struct std::pair<class ResourceID const ,struct unz64_file_pos_s> > > __cdecl CZipLoader::listFiles(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::filesystem::path const &)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@@[email protected]@[email protected]@@@[email protected][email protected][email protected][email protected]@[email protected]@@[email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzLocateFile referenced in function "bool __cdecl ZipArchive::extract(class boost::filesystem::path,class boost::filesystem::path,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >)" ([email protected]@@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzGetFilePos64 referenced in function "private: class std::unordered_map<class ResourceID,struct unz64_file_pos_s,struct std::hash<class ResourceID>,struct std::equal_to<class ResourceID>,class std::allocator<struct std::pair<class ResourceID const ,struct unz64_file_pos_s> > > __cdecl CZipLoader::listFiles(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::filesystem::path const &)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@@[email protected]@[email protected]@@@[email protected][email protected][email protected][email protected]@[email protected]@@[email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzGoToFilePos64 referenced in function "public: __cdecl CZipStream::CZipStream(class std::shared_ptr<class CIOApi>,class boost::filesystem::path const &,struct unz64_file_pos_s)" ([email protected]@[email protected][email protected]@@@[email protected]@[email protected]@[email protected]@[email protected]@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzGetCurrentFileInfo64 referenced in function "public: virtual unsigned int __cdecl CZipStream::calculateCRC32(void)" ([email protected]@@UEAAIXZ)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzOpenCurrentFile referenced in function "public: __cdecl CZipStream::CZipStream(class std::shared_ptr<class CIOApi>,class boost::filesystem::path const &,struct unz64_file_pos_s)" ([email protected]@[email protected][email protected]@@@[email protected]@[email protected]@[email protected]@[email protected]@@Z)
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzCloseCurrentFile referenced in function "public: virtual __cdecl CZipStream::~CZipStream(void)" ([email protected]@[email protected])
2>CZipLoader.obj : error LNK2019: unresolved external symbol __imp_unzReadCurrentFile referenced in function "bool __cdecl extractCurrent(void *,class std::basic_ostream<char,struct std::char_traits<char> > &)" ([email protected]@[email protected][email protected]@[email protected]@@[email protected]@@Z)
2>CZipSaver.obj : error LNK2019: unresolved external symbol __imp_zipOpen2_64 referenced in function "public: __cdecl CZipSaver::CZipSaver(class std::shared_ptr<class CIOApi>,class boost::filesystem::path const &)" ([email protected]@[email protected][email protected]@@@[email protected]@[email protected]@[email protected]@@Z)
2>CZipSaver.obj : error LNK2019: unresolved external symbol __imp_zipOpenNewFileInZip4_64 referenced in function "public: __cdecl CZipOutputStream::CZipOutputStream(class CZipSaver *,void *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z)
2>CZipSaver.obj : error LNK2019: unresolved external symbol __imp_zipWriteInFileInZip referenced in function "public: virtual __int64 __cdecl CZipOutputStream::write(unsigned char const *,__int64)" ([email protected]@@[email protected])
2>CZipSaver.obj : error LNK2019: unresolved external symbol __imp_zipCloseFileInZip referenced in function "public: virtual __cdecl CZipOutputStream::~CZipOutputStream(void)" ([email protected]@[email protected])
2>CZipSaver.obj : error LNK2019: unresolved external symbol __imp_zipClose referenced in function "public: virtual __cdecl CZipSaver::~CZipSaver(void)" ([email protected]@[email protected])
2>D:\temp\Krs\VCMI\build\bin\Release\VCMI_lib.dll : fatal error LNK1120: 16 unresolved externals
2>Done building project "vcmi.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 13 up-to-date, 0 skipped ==========

from the log it’s unclear which minizip/zlib it tried to link with.

btw new dependencies were released a few days ago, could you try with them? https://github.com/vcmi/vcmi-deps-windows/releases/download/v1.5/vcpkg-export-x64-windows-v140.7z At least on x86 Windows I had no issues with building.

Minizip should be our own. Newer versions from vcpkg do not work.

Ok I have switched to prebuilt vcpkg and gone back to VS 2019.
On Release x64:
gtest and gmock fail to build. [/WX] is turned on for some reason and it turns warnings into C2220 errors.
vcmitest is not building. I’ve unloaded it for the moment.

4>ErmRunner.cpp
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2653: 'scripting': is not a class or namespace name (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2065: 'Pool': undeclared identifier (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2059: syntax error: ')' (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2039: 'Result': is not a member of '`global namespace'' (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C3646: 'getContextPool': unknown override specifier (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2334: unexpected token(s) preceding '{'; skipping apparent function body (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19): error C2062: type 'unknown-type' unexpected (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,57): error C2238: unexpected token(s) preceding ';' (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BU.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2653: 'scripting': is not a class or namespace name (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BM.cpp)
4>D:\temp\Krs\VCMI\source\test\scripting\../mock/mock_IBattleInfoCallback.h(19,2): error C2065: 'Pool': undeclared identifier (compiling source file D:\temp\Krs\VCMI\source\test\erm\ERM_BM.cpp)