Could someone explain what the
__imp__fprintf
and
__imp____iob_func
unresolved external means?
Because I get these errors when I'm trying to compile:
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _ShowError
1>E:\Documents\Visual Studio 2015\Projects\SDL2_Test\Debug\SDL2_Test.exe : fatal error LNK1120: 2 unresolved externals
I can already say that the problem is not from linking wrong. I have linked everything up correctly, but for some reason it won't compile.
I'm trying to use SDL2.
I'm using Visual Studio 2015 as compiler.
I have linked to SDL2.lib and SDL2main.lib in Linker -> Input -> Additional Dependencies and I have made sure that the VC++ Directories are correct.
A more recent solution to this problem: Use the more recent sdl libs on
"https://buildbot.libsdl.org/sdl-builds/sdl-visualstudio/?C=M;O=D"
They seem to have fixed the problem, although it's only the 32 bit library (I think).
This can happen when you link to msvcrt.dll instead of msvcr10.dll (or similar), which is a good plan. Because it will free you up to redistribute your Visual Studio's runtime library inside your final software package.
That workaround helps me (at Visual Studio 2008):
This snippet is not needed for Visual Studio 6 and its compiler. Therefore the #ifdef.
I don't know why but:
After the includes but before your main should fix it from my experience.
Microsoft has a special note on this (https://msdn.microsoft.com/en-us/library/bb531344.aspx#BK_CRT):
To Milan Babuškov, IMO, this is exactly what the replacement function should look like :-)
I had the same issue in VS2015. I have solved it by compiling the SDL2 sources in VS2015.