The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Compiling SDL2 Application on Windows 7 32bit + MinGW/Msys
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
Hello ladies and gents,

Just as a note, I've came across this issue before and was able to resolve it by using Visual Studio (rather than mingw), but I don't know that this should be necessary.


I've written an SDL2 based library, and created a make file:


Quote:
CC=mingw32-g++
CFLAGS=-O2 -Wall `sdl2-config --cflags` -I./include
LDFLAGS=`sdl2-config --libs` -lSDL2_ttf -lopengl32 -lglu32
OTHERFLAGS=-static
SOURCES=application.cpp event.cpp exceptions.cpp thread.cpp window.cpp
EXECUTABLE=sdlui

all:
$(CC) $(OTHERFLAGS) $(CFLAGS) $(LDFLAGS) $(SOURCES) -o $(EXECUTABLE)

clean-executable:
rm -f $(EXECUTABLE)

clean: clean-executable

rebuild: clean all



 The output I get, however, is quite bad:


Quote:
$ mingw32-make -f Makefile.win32
mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include `sdl2-config --libs` -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cp
p exceptions.cpp thread.cpp window.cpp -o sdlui
C:/MinGW/msys/1.0/local/lib\libSDL2main.a(SDL_windows_main.o): In function `console_main':
c:\Users\Alexander\SDL\x86/../src/main/windows/SDL_windows_main.c:145: undefined reference to `SDL_main'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x216): undefined reference to `SDL_PollEvent'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x24d): undefined reference to `SDL_PollEvent'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x3e7): undefined reference to `SDL_Init'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x40c): undefined reference to `barrysoft::FontFactory::getInstance()'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x5cc): undefined reference to `barrysoft::FontFactory::getInstance()'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x5da): undefined reference to `barrysoft::FontFactory::~FontFactory()'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccyTTLzr.o:application.cpp:(.text+0x5e7): undefined reference to `SDL_Quit'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccHX8h2N.o:exceptions.cpp:(.text+0x3b): undefined reference to `glGetError@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccHX8h2N.o:exceptions.cpp:(.text+0xc3d): undefined reference to `SDL_GetError'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccHX8h2N.o:exceptions.cpp:(.text+0x15f1): undefined reference to `SDL_GetError'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0xf): undefined reference to `SDL_mutexP'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x4a): undefined reference to `SDL_CreateMutex'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x88): undefined reference to `SDL_mutexP'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x97): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0xb7): undefined reference to `SDL_mutexP'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x15a): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x162): undefined reference to `SDL_Delay'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x1ad): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x270): undefined reference to `SDL_mutexP'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x2a0): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x35b): undefined reference to `SDL_mutexP'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x434): undefined reference to `SDL_WaitThread'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x43f): undefined reference to `SDL_DestroyMutex'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x4b2): undefined reference to `SDL_CreateMutex'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x4d1): undefined reference to `SDL_CreateThread'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x23): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x6a): undefined reference to `SDL_DestroyMutex'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x2b8): undefined reference to `SDL_mutexP'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x2c8): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccwWc5Uo.o:thread.cpp:(.text+0x389): undefined reference to `SDL_mutexV'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0xe2): undefined reference to `SDL_CreateWindow'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x175): undefined reference to `SDL_SetWindowSize'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x1c7): undefined reference to `SDL_SetWindowPosition'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x211): undefined reference to `SDL_GL_DeleteContext'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x24c): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x252): undefined reference to `glPushMatrix@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x257): undefined reference to `glLoadIdentity@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x2b3): undefined reference to `glOrtho@48'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x2c2): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x2db): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x2e1): undefined reference to `glPopMatrix@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x2ed): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x30d): undefined reference to `SDL_GL_MakeCurrent'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x37b): undefined reference to `SDL_GL_CreateContext'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x392): undefined reference to `SDL_GL_SetSwapInterval'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x3a6): undefined reference to `SDL_GL_SetAttribute'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x3ba): undefined reference to `SDL_GL_SetAttribute'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x3ce): undefined reference to `SDL_GL_SetAttribute'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x3e2): undefined reference to `SDL_GL_SetAttribute'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x3f6): undefined reference to `SDL_GL_SetAttribute'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x40a): more undefined references to `SDL_GL_SetAttribute' follow
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x42e): undefined reference to `glClearColor@16'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x455): undefined reference to `glViewport@16'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x464): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x46a): undefined reference to `glLoadIdentity@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x4af): undefined reference to `gluPerspective@32'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x4be): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x4c4): undefined reference to `glLoadIdentity@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x4d8): undefined reference to `glBlendFunc@8'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x4e7): undefined reference to `glLineWidth@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x4f4): undefined reference to `glEnable@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x501): undefined reference to `glEnable@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x50e): undefined reference to `glGetString@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x51f): undefined reference to `glGetString@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x52e): undefined reference to `glGetString@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x100): undefined reference to `SDL_GetWindowPosition'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x116): undefined reference to `SDL_DestroyWindow'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x130): undefined reference to `SDL_GetWindowID'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x140): undefined reference to `SDL_ShowWindow'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x150): undefined reference to `SDL_HideWindow'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x1e5): undefined reference to `SDL_GetWindowPosition'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x1f8): undefined reference to `SDL_GetWindowID'
C:\Users\ALEXAN~1\AppData\Local\Temp\cccMCOUz.o:window.cpp:(.text+0x2cc): undefined reference to `glLoadIdentity@0'
collect2: ld returned 1 exit status
mingw32-make: *** [all] Error 1


So, first thing I thought was the sdl2-config was giving bad output, so I did sdl2-config --libs --cflags and got this:
Quote:
$ sdl2-config --libs --cflags
-L/usr/local/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
-I/usr/local/include/SDL2 -Dmain=SDL_main 


The directories and libraries are all correct.


So, now I'm down to a few options.  Either I broke my mingw/msys config (which is possible), or SDL2 broke mingw32 builds.


Anyone else with experience with the latest SDL2 from hg (just pulled this morning) and mingw32?  If anyone else has built it, then I'll try re-installing mingw32 to see if that fixes it.


Thanks,
-Alex 
Compiling SDL2 Application on Windows 7 32bit + MinGW/Msys
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
Quote:
 The output I get, however, is quite bad:


Quote:
$ mingw32-make -f Makefile.win32
mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include `sdl2-config --libs` -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cp
p exceptions.cpp thread.cpp window.cpp -o sdlui
C:/MinGW/msys/1.0/local/lib\libSDL2main.a(SDL_windows_main.o): In function `console_main':
c:\Users\Alexander\SDL\x86/../src/main/windows/SDL_windows_main.c:145: undefined reference to `SDL_main'


Can you try running mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cpp exceptions.cpp thread.cpp window.cpp -o sdlui `sdl2-config --libs`


That is with the SDL2 libraries at the end of the command line, if you updated MingW32 recently it's possible they've switched GCC versions and the dependency solving "feature/bug" is causing those unresolved symbols.



--
Gabriel.
Compiling SDL2 Application on Windows 7 32bit + MinGW/Msys
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
That gives me a bunch of different errors, but it does link to SDL:

Quote:
$ mingw32-make -f Makefile.win32
mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cpp exceptions.cpp thre
ad.cpp window.cpp `sdl2-config --libs`
C:\Users\ALEXAN~1\AppData\Local\Temp\ccIHv7Y9.o:application.cpp:(.text+0x40c): undefined reference to `barrysoft::FontFactory::getInstance()'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccIHv7Y9.o:application.cpp:(.text+0x5cc): undefined reference to `barrysoft::FontFactory::getInstance()'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccIHv7Y9.o:application.cpp:(.text+0x5da): undefined reference to `barrysoft::FontFactory::~FontFactory()'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccHl0o9i.o:exceptions.cpp:(.text+0x3b): undefined reference to `glGetError@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x24c): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x252): undefined reference to `glPushMatrix@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x257): undefined reference to `glLoadIdentity@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x2b3): undefined reference to `glOrtho@48'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x2c2): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x2db): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x2e1): undefined reference to `glPopMatrix@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x2ed): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x42e): undefined reference to `glClearColor@16'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x455): undefined reference to `glViewport@16'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x464): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x46a): undefined reference to `glLoadIdentity@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x4af): undefined reference to `gluPerspective@32'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x4be): undefined reference to `glMatrixMode@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x4c4): undefined reference to `glLoadIdentity@0'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x4d8): undefined reference to `glBlendFunc@8'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x4e7): undefined reference to `glLineWidth@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x4f4): undefined reference to `glEnable@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x501): undefined reference to `glEnable@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x50e): undefined reference to `glGetString@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x51f): undefined reference to `glGetString@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x52e): undefined reference to `glGetString@4'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccG2UubQ.o:window.cpp:(.text+0x2cc): undefined reference to `glLoadIdentity@0'
C:/MinGW/msys/1.0/local/lib\libSDL2main.a(SDL_windows_main.o): In function `console_main':
c:\Users\Alexander\SDL\x86/../src/main/windows/SDL_windows_main.c:145: undefined reference to `SDL_main'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_systimer.o): In function `SDL_StartTicks':
c:\Users\Alexander\SDL\x86/../src/timer/windows/SDL_systimer.c:63: undefined reference to `timeBeginPeriod@4'
c:\Users\Alexander\SDL\x86/../src/timer/windows/SDL_systimer.c:64: undefined reference to `timeGetTime@0'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_systimer.o): In function `SDL_GetTicks':
c:\Users\Alexander\SDL\x86/../src/timer/windows/SDL_systimer.c:89: undefined reference to `timeGetTime@0'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_dxjoystick.o): In function `SDL_SYS_JoystickInit':
c:\Users\Alexander\SDL\x86/../src/joystick/windows/SDL_dxjoystick.c:297: undefined reference to `CoCreateInstance@20'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_CloseDevice':
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:185: undefined reference to `waveInClose@4'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:190: undefined reference to `waveOutClose@4'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:197: undefined reference to `waveOutUnprepareHeader@12'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:197: undefined reference to `waveOutUnprepareHeader@12'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_PlayDevice':
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:144: undefined reference to `waveOutWrite@12'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_winmm.o): In function `DetectWaveInDevs':
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:55: undefined reference to `waveInGetNumDevs@0'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:55: undefined reference to `waveInGetDevCapsW@12'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_winmm.o): In function `DetectWaveOutDevs':
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:54: undefined reference to `waveOutGetNumDevs@0'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:54: undefined reference to `waveOutGetDevCapsW@12'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_OpenDevice':
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:228: undefined reference to `waveInGetNumDevs@0'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:231: undefined reference to `waveInGetDevCapsW@12'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:241: undefined reference to `waveOutGetNumDevs@0'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:244: undefined reference to `waveOutGetDevCapsW@12'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:320: undefined reference to `waveInOpen@24'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:378: undefined reference to `waveOutPrepareHeader@12'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:378: undefined reference to `waveOutPrepareHeader@12'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:324: undefined reference to `waveOutOpen@24'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_winmm.o): In function `SetMMerror':
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:115: undefined reference to `waveOutGetErrorTextW@12'
c:\Users\Alexander\SDL\x86/../src/audio/winmm/SDL_winmm.c:115: undefined reference to `waveOutGetErrorTextW@12'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_syshaptic.o): In function `SDL_SYS_HapticInit':
c:\Users\Alexander\SDL\x86/../src/haptic/windows/SDL_syshaptic.c:159: undefined reference to `CoCreateInstance@20'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windows.o): In function `WIN_CoInitialize':
c:\Users\Alexander\SDL\x86/../src/core/windows/SDL_windows.c:47: undefined reference to `CoInitialize@4'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windows.o): In function `WIN_CoUninitialize':
c:\Users\Alexander\SDL\x86/../src/core/windows/SDL_windows.c:61: undefined reference to `CoUninitialize@0'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IPPASink_QueryInterface@12':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:1122: undefined reference to `IID_IUnknown'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `UIElementSink_QueryInterface@12':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:1015: undefined reference to `IID_IUnknown'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `UILess_GetCandidateList':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:986: undefined reference to `SysFreeString@4'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetId':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:551: undefined reference to `ImmGetIMEFileNameA@12'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:566: undefined reference to `GetFileVersionInfoSizeA@8'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:570: undefined reference to `GetFileVersionInfoA@16'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:571: undefined reference to `VerQueryValueA@16'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_SetupAPI':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:617: undefined reference to `ImmGetIMEFileNameA@12'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:630: undefined reference to `ImmGetContext@4'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:633: undefined reference to `ImmReleaseContext@8'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_ClearComposition':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetContext@4'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:687: undefined reference to `ImmNotifyIME@16'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:691: undefined reference to `ImmNotifyIME@16'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:692: undefined reference to `ImmReleaseContext@8'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:689: undefined reference to `ImmSetCompositionStringW@24'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Disable':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:367: undefined reference to `ImmAssociateContext@8'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Init':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:326: undefined reference to `ImmGetContext@4'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:327: undefined reference to `ImmReleaseContext@8'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `UILess_SetupSinks':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:1195: undefined reference to `CoCreateInstance@20'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `UIElementSink_BeginUIElement@12':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:1054: undefined reference to `SysFreeString@4'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `UIElementSink_UpdateUIElement@8':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:1081: undefined reference to `SysFreeString@4'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Quit':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:381: undefined reference to `ImmAssociateContext@8'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Init':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:312: undefined reference to `CoCreateInstance@20'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Enable':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:352: undefined reference to `ImmAssociateContext@8'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Init':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:312: undefined reference to `CoCreateInstance@20'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_HandleMessage':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:854: undefined reference to `ImmGetContext@4'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCompositionString':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:699: undefined reference to `ImmGetCompositionStringW@16'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:704: undefined reference to `ImmGetCompositionStringW@16'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_HandleMessage':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:892: undefined reference to `ImmReleaseContext@8'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:887: undefined reference to `ImmGetContext@4'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCandidateList':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:766: undefined reference to `ImmGetCandidateListW@16'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCompositionString':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:699: undefined reference to `ImmGetCompositionStringW@16'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:704: undefined reference to `ImmGetCompositionStringW@16'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetReadingString':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:425: undefined reference to `ImmGetContext@4'
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:498: undefined reference to `ImmReleaseContext@8'
C:/MinGW/msys/1.0/local/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCandidateList':
c:\Users\Alexander\SDL\x86/../src/video/windows/SDL_windowskeyboard.c:770: undefined reference to `ImmGetCandidateListW@16'
collect2: ld returned 1 exit status
mingw32-make: *** [all] Error 1


Not sure how to fix this either, but we're moving in the right direction Smile
-Alex

On Sat, Aug 11, 2012 at 1:20 PM, Gabriel Jacobo wrote:
Quote:
Quote:
 The output I get, however, is quite bad:


Quote:
$ mingw32-make -f Makefile.win32
mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include `sdl2-config --libs` -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cp
p exceptions.cpp thread.cpp window.cpp -o sdlui
C:/MinGW/msys/1.0/local/lib\libSDL2main.a(SDL_windows_main.o): In function `console_main':
c:\Users\Alexander\SDL\x86/../src/main/windows/SDL_windows_main.c:145: undefined reference to `SDL_main'



Can you try running mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cpp exceptions.cpp thread.cpp window.cpp -o sdlui `sdl2-config --libs`


That is with the SDL2 libraries at the end of the command line, if you updated MingW32 recently it's possible they've switched GCC versions and the dependency solving "feature/bug" is causing those unresolved symbols.



--
Gabriel.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Compiling SDL2 Application on Windows 7 32bit + MinGW/Msys
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
2012/8/11 Alex Barry
Quote:
That gives me a bunch of different errors, but it does link to SDL:

Quote:
$ mingw32-make -f Makefile.win32
mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cpp exceptions.cpp thre
ad.cpp window.cpp `sdl2-config --libs`
mingw32-make: *** [all] Error 1


Not sure how to fix this either, but we're moving in the right direction Smile
-Alex




The solution is to start rearranging your command so libraries that depend on others appear first (in a left to right order) in the command line...


So, as SDL2_ttf depends on SDL2, you'd put it first. After SDL2 you'd put opengl32 because SDL2 will be using it,etc. It may be even possible you'll need to list a library twice.





--
Gabriel.
Compiling SDL2 Application on Windows 7 32bit + MinGW/Msys
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
Just a note to other people who come across this thread, what I ended up doing was reverting to an older version of gcc and g++ by doing the following in the msys shell:

$ mingw-get install gcc-v3-core
$ mingw-get install gcc-v3-c++


Note: This will change the default gcc version on your system - if you want to return to gcc 4.x (I think the names may change in the eventual future of gcc 5.x), do:
$ mingw-get install gcc-core
$ mingw-get install gcc-c++


Then, I was originally trying to build a static library, which was still giving me issues in gcc 3.x, so I tried building with -shared rather than -static, and everything built fine.


Gabriel, thanks for the troubleshooting - I've been doing a lot of windows development for work lately and haven't touched gcc in a while.  I'm sort of surprised at how messed up the linker is in gcc 4.5.x, but maybe that's intentional in some sense?  I don't know, but anyway, thanks for the help!


Hope that helps someone else down the road, too,
-Alex

On Sat, Aug 11, 2012 at 3:42 PM, Gabriel Jacobo wrote:
Quote:
2012/8/11 Alex Barry
Quote:
That gives me a bunch of different errors, but it does link to SDL:


Quote:
$ mingw32-make -f Makefile.win32
mingw32-g++ -static -O2 -Wall `sdl2-config --cflags` -I./include -lSDL2_ttf -lopengl32 -lglu32 application.cpp event.cpp exceptions.cpp thre
ad.cpp window.cpp `sdl2-config --libs`

mingw32-make: *** [all] Error 1


Not sure how to fix this either, but we're moving in the right direction Smile
-Alex





The solution is to start rearranging your command so libraries that depend on others appear first (in a left to right order) in the command line...


So, as SDL2_ttf depends on SDL2, you'd put it first. After SDL2 you'd put opengl32 because SDL2 will be using it,etc. It may be even possible you'll need to list a library twice.





--
Gabriel.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org