so i'm getting the following errors:
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
my code is simply:
#include <iostream>
#include "SDL2\SDL.h"
int main(int argc, char* argv[])
{
std::cout << "Hello World!" << std::endl;
return 0;
}
i've linked the libraries correctly, and this works fine in vs2012, but for some reason won't compile in vs2015.
I had the same issue with SDL 1.2 - the solution that worked for me was to download SDL source and build the lib with VS 2015. The problem was fixed when I linked to the newly (VS2015) built libs - maybe someone should try the same for SDL 2 (rebuild lib from source)?
idk if it's something in vs2015's default runtime libraries why it's causing these unresolved externals or something not default linked anymore when making a win32 console project, but one of the unresolved externals go away when i switch the runtime library to /MTd, imp_iob_func still appears, but the solution i ended up going with is downloading the sdl2 source code, which is free, going to the sdl2main project file, editting the showerror function
from
fprintf(stderr, "%s: %s\n", title, message);
to
printf("%s: %s\n", title, message);
so, this may or may not be a horrible idea, but hey well, it builds and compiles. i just replaced my sdl2main.lib with the new modified one. and voila no more linker error. so this may or may not have been a horrible mistake and will bite me whenever i ask sdl to produce an error message. i'll probably add an edit or comment to this in the future if i find a better solution or confirm this was a big mistake. but this is what i got to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With