error LNK2001: unresolved external symbol __CxxFrameHandler4 and __GSHandlerCheck_EH4

Viewed 4304

I'm trying to build a library and link it to an app. Library build is fine, but linking to the app throws these errors:

clipper.lib(clipper.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4

clipper.lib(clipper.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4

Cause

According to this and that, the errors might be due to building the lib with VS 2019 toolset, but the app is using VS 2017 toolset.


Tried

I'm building the library with these commands:

cd lib/src/clipper
mkdir build
cd build/
cmake ..
cmake --build . --config Debug
cmake --build . --config Release

Even on VS 2017 Command Prompt, CMake builds the lib for VS 2019:

CMake log screenshot

Question

What is the easiest/fastest way to force CMake to build for VS 2017 rather than 2019?

1 Answers

As commented by @Tsyvarev , the errors got resolved by replacing

cmake .. 

with:

cmake  -G "Visual Studio 15 2017 Win64" ..
Related