SDL 1.3 Release Build Errors using VS2010

Attempting to build the release version of SDL 1.3 using VS 2010 has resulted in the following build errors:

1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _VerQueryValueA at 16 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _GetFileVersionInfoA at 16 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _GetFileVersionInfoSizeA at 8 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmGetIMEFileNameA at 12 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmReleaseContext at 8 referenced in function _IME_SetupAPI
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmGetContext at 4 referenced in function _IME_SetupAPI
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmSetCompositionStringW at 24 referenced in function _IME_ClearComposition
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmNotifyIME at 16 referenced in function _IME_ClearComposition
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmGetCompositionStringW at 16 referenced in function _IME_GetCompositionString
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmGetCandidateListW at 16 referenced in function _IME_GetCandidateList
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol _ImmAssociateContext at 8 referenced in function _IME_Disable
1>.\Release\SDL.dll : fatal error LNK1120: 11 unresolved externals

I checked the Code Generation settings and ensured that Mult-threaded DLL (/MD) is selected for the Runtime Library setting.

You need to install the Windows SDK (either version 7.0a or 7.1). If you
already have it installed then all you have to do is add the include and lib
paths to your VS2010 VC++ Directory settings. You will find this under
Tools / Options / Projects and Solutions / VC++ Directories.

KenFrom: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of falco
Sent: Tuesday, March 01, 2011 11:25 AM
To: sdl at lists.libsdl.org
Subject: [SDL] SDL 1.3 Release Build Errors using VS2010

Attempting to build the release version of SDL 1.3 using VS 2010 has
resulted in the following build errors:

1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_VerQueryValueA at 16 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_GetFileVersionInfoA at 16 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_GetFileVersionInfoSizeA at 8 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmGetIMEFileNameA at 12 referenced in function _IME_GetId
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmReleaseContext at 8 referenced in function _IME_SetupAPI
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmGetContext at 4 referenced in function _IME_SetupAPI
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmSetCompositionStringW at 24 referenced in function _IME_ClearComposition
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmNotifyIME at 16 referenced in function _IME_ClearComposition
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmGetCompositionStringW at 16 referenced in function
_IME_GetCompositionString
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmGetCandidateListW at 16 referenced in function _IME_GetCandidateList
1>SDL_windowskeyboard.obj : error LNK2019: unresolved external symbol
_ImmAssociateContext at 8 referenced in function _IME_Disable
1>.\Release\SDL.dll : fatal error LNK1120: 11 unresolved externals

I checked the Code Generation settings and ensured that Mult-threaded DLL
(/MD) is selected for the Runtime Library setting.

You might also have to make sure that

msvcrt.lib;msimg32.lib;version.lib;winmm.lib;imm32.lib;%(AdditionalDependencies)

and not just

msimg32.lib;winmm.lib;%(AdditionalDependencies)

is set in Configuration Properties > Linker > Input > Additional Dependencies. That is how it is set for Debug Win32 (which builds “right out of the box” for me), and changing that was what fixed those same “unresolved external symbol” errors for me in Release Win32 (I think all of those libraries are needed and used by the program).

Unfortunately, the latter is how it is set by default in Release Win32 (see lines 142 to 176, and especially 171 (http://hg.libsdl.org/SDL/file/f8588afb6486/VisualC/SDL/SDL_VS2010.vcxproj#l142) of the original VS 2010 SDL project file). I think this is a bug in the original and that it should be changed to use the former setting. Anyone agree?

Thanks AnOddName. The solution you provided worked.

Thanks, this is now fixed in the current snapshot. I also fixed linking the
64-bit release library.
http://www.libsdl.org/tmp/SDL-1.3.zip

Cheers!On Thu, Mar 3, 2011 at 10:24 PM, AnOddName wrote:

You might also have to make sure that

msvcrt.lib;msimg32.lib;version.lib;winmm.lib;imm32.lib;%(AdditionalDependencies)

and not just

msimg32.lib;winmm.lib;%(AdditionalDependencies)

is set in Configuration Properties > Linker > Input > Additional
Dependencies. That is how it is set for Debug Win32 (which builds “right out
of the box” for me), and changing that was what fixed those same “unresolved
external symbol” errors for me in Release Win32 (I think all of those
libraries are needed and used by the program).

Unfortunately, the latter is how it is set by default in Release Win32 (see
lines 142 to 176, and especially 171http://hg.libsdl.org/SDL/file/f8588afb6486/VisualC/SDL/SDL_VS2010.vcxproj#l142of the original VS 2010 SDL project file). I think this is a bug in the
original and that it should be changed to use the former setting. Anyone
agree?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and CEO, Galaxy Gameworks

No problem, falco and Sam.

Indeed, after the recent updates the SDL project now builds in Debug 32, Debug 64, Release 32, and Release 64 right out of box. Yay!

I’ll note one last thing while I’m here (may be another bug, but not a build-stopping error):

The SDL project has files resource.h and Version.rc for version info, but they’re not referenced in the projects by default. If you build the DLL and it doesn’t show “Copyright ? 2009 Sam Lantinga” and the version number on right click > Properties > Details, drag the two files resource.h and Version.rc from VisualC\SDL to the SDL project in Visual Studio and build again.

Fixed, thanks! :)On Wed, Mar 9, 2011 at 12:04 AM, AnOddName wrote:

No problem, falco and Sam.

Indeed, after the recent updates the SDL project now builds in Debug 32,
Debug 64, Release 32, and Release 64 right out of box. Yay!

I’ll note one last thing while I’m here (may be another bug, but not a
build-stopping error):

The SDL project has files resource.h and Version.rc for version info, but
they’re not referenced in the projects by default. If you build the DLL and
it doesn’t show “Copyright ? 2009 Sam Lantinga” and the version number on
right click > Properties > Details, drag the two files resource.h and
Version.rc from VisualC\SDL to the SDL project in Visual Studio and build
again.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and CEO, Galaxy Gameworks