We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2398

Summary: linking errors and undefined references when cross-compiling with mxe
Product: SDL Reporter: niek <nieknooijens>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 2.0.1   
Hardware: x86   
OS: Windows (All)   

Description niek 2014-02-14 14:52:52 UTC
Hi there,

While compiling performous (performous.org) for windows we use MXE (mxe.cc) to install the cross-compiler and all the dependencies, SDL1.2 + portaudio caused conflicts, so I recently ported everything to SDL2, I now get different linking errors: 

Built target ss_pak_extract
[ 31%] Building RC object game/CMakeFiles/performous.dir/__/performous.rc.res
Linking CXX executable ../Performous.exe
/opt/mxe/usr/lib/gcc/i686-pc-mingw32.static/4.8.2/../../../../i686-pc-mingw32.static/lib/libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetId':
/opt/mxe/tmp-sdl2/SDL2-2.0.1/src/video/windows/SDL_windowskeyboard.c:545: undefined reference to `GetFileVersionInfoSizeA@8'
/opt/mxe/tmp-sdl2/SDL2-2.0.1/src/video/windows/SDL_windowskeyboard.c:549: undefined reference to `GetFileVersionInfoA@16'
/opt/mxe/tmp-sdl2/SDL2-2.0.1/src/video/windows/SDL_windowskeyboard.c:550: undefined reference to `VerQueryValueA@16'
/opt/mxe/tmp-sdl2/SDL2-2.0.1/src/video/windows/SDL_windowskeyboard.c:545: undefined reference to `GetFileVersionInfoSizeA@8'
/opt/mxe/tmp-sdl2/SDL2-2.0.1/src/video/windows/SDL_windowskeyboard.c:549: undefined reference to `GetFileVersionInfoA@16'
/opt/mxe/tmp-sdl2/SDL2-2.0.1/src/video/windows/SDL_windowskeyboard.c:550: undefined reference to `VerQueryValueA@16'
collect2: error: ld returned 1 exit status
make[2]: *** [Performous.exe] Fout 1
make[1]: *** [game/CMakeFiles/performous.dir/all] Fout 2
make: *** [all] Fout 2

WTF??
Comment 1 niek 2014-02-17 08:27:09 UTC
I tried again yesterday but this time I linked SDL dynamically in stead of statically, then the problem went away and portaudio started spamming errors, apparently portaudio and SDL don't like each other.
Comment 2 Sam Lantinga 2014-02-23 01:26:35 UTC
According to MSDN these link errors will be resolved if you link with version.lib.
I'm not sure what that corresponds to in your build environment, but I don't think it's a conflict with portaudio.

Cheers!