LNK2019 unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT SDL2
Solution 1
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).
Solution 2
If you end up here because you Googled "error LNK2001: unresolved external symbol __CrtDbgReport" here is a simple thing to check...
If you are comparing working DEBUG to non-working RELEASE project settings and copy/paste between them, it is easy to copy a preprocessor definition, "_DEBUG" into a RELEASE project by mistake. I just chased my tail for two frustrating hours after a quick and sloppy cut-n-paste... see how long it takes to find it below:
WIN32_LEAN_AND_MEAN;WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
Solution 3
in my case it was because in the runtime library option of the project I used /MD
in debug instead of /MDd
so it was building fine in release but not in debug
elect
https://github.com/elect86/ https://github.com/kotlin-graphics
Updated on July 20, 2022Comments
-
elect almost 2 years
I am trying to get apitest compiled..
cloned and
cmake -G "Visual Studio 14 2015 Win64" ..
as instructed, everything okFirst 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 librariesvcruntimed.lib
anducrtd.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
underC:\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 asmsvcrtd.lib
. Insteaducrtd.lib
is located underC:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64
Thanks in advance..
Ps: I have VS15 Community Edition
-
elect about 8 yearsCan you believe I had to clone it again and now I get different errors?
LNK2001 unresolved external symbol _RTC_CheckStackVars SDL2 C:\Users\GBarbieri\Documents\Visual Studio 2015\Projects\apitest\_out\thirdparty\SDL2-2.0.1\SDL_dxjoystick.obj
-
Rudolfs Bundulis about 8 yearsSee this - stackoverflow.com/questions/6642571/…