Reputation: 4428
I have a program that compiles with no errors under Linux, but when I compile it for Windows using MinGW it can't run as it says that it requires some DLL's next to it. So I decided to statically link it, but it outputs some errors:
/usr/i586-mingw32msvc/lib/libsfml-window-s.a(WindowImplWin32.o):WindowImplWin32.cpp:(.text+0x146e): undefined reference to `__Unwind_Resume'
/usr/i586-mingw32msvc/lib/libsfml-window-s.a(WindowImplWin32.o):WindowImplWin32.cpp:(.text+0x17d0): more undefined references to `__Unwind_Resume' follow
/usr/i586-mingw32msvc/lib/libsfml-window-s.a(WindowImplWin32.o):WindowImplWin32.cpp:(.eh_frame+0x12): undefined reference to `___gxx_personality_v0'
/usr/i586-mingw32msvc/lib/libsfml-window-s.a(Joystick.o):Joystick.cpp:(.eh_frame+0x11): undefined reference to `___gxx_personality_v0'
collect2: ld returned 1 exit status
It seems like it has some external dependencies. What are those, and how do I link them?
Edit:
Here's what I put in the command line:
i586-mingw32msvc-g++ "./main.cpp" -o "./win32.exe" /usr/i586-mingw32msvc/lib/libsfml-graphics-s.a /usr/i586-mingw32msvc/lib/libsfml-window-s.a /usr/i586-mingw32msvc/lib/libm.a /usr/i586-mingw32msvc/lib/libmsvcr90.a
Help would be appreciated.
Upvotes: 4
Views: 2560
Reputation: 1493
I had this problem too recently.
It's that SFML is compiled with DW2 exception handling, but the default MinGW cross-compiler (in the Debain and Ubuntu repos) uses SJLJ, and these are not compatible with each other. I had to build my own cross-compiler with DW2 exception handling, and that works flawlessly. Alternatively, you can build SFML itself with your existing SJLJ compiler, so SFML will be SJLJ too.
I decided to build a DW2 compiler, because it is the more modern method, and it was a good exercise too.
Upvotes: 1