c++linkervisual-studio-2015

LNK2019 unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT SDL2


I am trying to get apitest compiled..

cloned and cmake -G "Visual Studio 14 2015 Win64" .. as instructed, everything ok

First problem, a lot of this, I don't get even the error list:

error LNK2019: unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT

Gogled, and they say to switch

Project Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library

from Multi-threaded DLL to Multi-threaded Debug DLL

Ok, I try to build again, it fails again, but at least this time I get the error list..

Again my friend:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT   SDL2    C:\Users\GBarbieri\Documents\Visual Studio 2015\Projects\apitest\_out\thirdparty\SDL2-2.0.1\MSVCRTD.lib(_init_.obj) 1   

This answer says the project is being linked with only part of the C runtime (CRT) libary, msvcrtd.lib. I also need to link with the libraries vcruntimed.lib and ucrtd.lib.

Good, but how?

The apitest is a solution based on many projects, I guess I have to manually add something into the SDL2 one. I tried a lot of attempts, especially under Linker -> Input -> Additional Dependencies, but I never got it working

I found msvcrtd.lib under C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib although I guess the solution is trying to build its own.

I found vcruntimed.lib under the same place as msvcrtd.lib. Instead ucrtd.lib is located under C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64

Thanks in advance..

Ps: I have VS15 Community Edition


Solution

  • It seems to be an SDL issue. Here is a discussion on it in the SDL forum and basically there are following solutions - adding the libraries you mentioned , taking a proper VS2015 release build (there is a link in the thread) or building SDL from sources (the thread mentions that that should work too).