10

I recently was forced to upgrade from Visual Studio 2015 Pre-Release to Visual Studio 2015 Release Candidate as a result of an expired license.

My project was previously building fine, however, now it is not. I am getting only two link errors and I've spent the last two days attempting to address them:

    1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp_fprintf
    1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp___iob_func

I am linking to SDL2main as I got it from their website, I got the same error with version 2.0.0 and version 2.0.3, so I don't think it's an issue with the specific version.

I have the following directories specified for libraries (note the x64 folders, I am building 64 bit, I also built boost with "b2 address-model=64").

$(SolutionDir)../external/boost_1_58_0/stage/lib/
$(SolutionDir)../external/SDL/SDL2_ttf-2.0.12/lib/x64/
$(SolutionDir)../external/SDL/SDL2_mixer-2.0.0/lib/x64/
$(SolutionDir)../external/SDL/SDL2_image-2.0.0/lib/x64/
$(SolutionDir)../external/SDL/SDL2-2.0.0/lib/x64/
$(LibraryPath)

Note: I've tried SDL2-2.0.3 and SDL2-2.0.0 which is the one my previously working build used (with VS2015.)

I do not have Visual Studio 2013 installed and my platform toolset had to be upgraded to Visual Studio 2015 (v140) but I've also tried the only other option: Visual Studio 2015 - Windows XP (v140_xp)

What I am looking for is a straight-forward answer as to how to resolve this. I can offer further details if requested.

M2tM
  • 4,415
  • 1
  • 34
  • 43
  • 1
    *linking to SDL2main as I got it from their website* you should probably build it yourself instead – stijn May 21 '15 at 07:02
  • Built SDL2 and seems to compile, going to need to get it to run though as I have to update some DLL's too. – M2tM May 21 '15 at 07:16
  • 1
    Seems to have worked, if you'd like some points just go ahead and answer it. :) @stijn I did not need to compile SDL mixer, image, or ttf, just the SDL main project. – M2tM May 21 '15 at 07:19
  • Well, might be usefull for future visitors so i'll make an answer – stijn May 21 '15 at 07:23
  • @stijn Just a follow up for fun: Yeah, this question seems to be relevant as I've had people trickling in over the last few months upvoting it. Thanks again for your time! – M2tM Sep 29 '15 at 23:01

1 Answers1

2

SDL2main is not built against the same VS version as you are using, and there is no real guarantee anything in pre-release/RC versions is completely backwards compatible. If you have the source it is always a good idea to build everything yourself, with roughly the same build options - especially those for static/dynamic linking and multi-threading etc - so that you end up with libraries which are fully compatible with each other.

Also see this report

stijn
  • 34,664
  • 13
  • 111
  • 163