SDL_image library not linking (MinGW)

S

soulfreshner

I'm using windows and compiling with MinGW.

After compiling and installing SDL successfully, I tried following
this tut (http://lazyfoo.net/SDL_tutorials/lesson03/windows/mingw/
index.php) to get SDL_image up and running. Trying to compile the code
gives me linker errors:

g++ -I/mingw//include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -L/mingw//
lib -lmingw3 2 -lSDLmain -lSDL -lSDL_image -mwindows
sdl_blit_stuff.cpp -o test.exe
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x23): und efined reference to `IMG_Load'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x37): und efined reference to `SDL_DisplayFormat'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x45): und efined reference to `SDL_FreeSurface'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x7f): und efined reference to `SDL_UpperBlit'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0xc6): und efined reference to `SDL_SetVideoMode'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0xf1): und efined reference to `SDL_WM_SetCaption'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x239): un defined reference to `SDL_FreeSurface'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x2a4): un defined reference to `SDL_Flip'
C:/DOCUME~1/Derick/LOCALS~1/Temp/cc2Pbaaa.o:sdl_blit_stuff.cpp:(.text
+0x2c4): un defined reference to `SDL_PollEvent'
collect2: ld returned 1 exit status
make: *** [test] Error 1

It looks like I'm not linking something, but much googling still gave
me nothing. Any ideas?
-d-
 
R

red floyd

soulfreshner said:
I'm using windows and compiling with MinGW.

After compiling and installing SDL successfully, I tried following
this tut (http://lazyfoo.net/SDL_tutorials/lesson03/windows/mingw/
index.php) to get SDL_image up and running. Trying to compile the code
gives me linker errors:

[linker stuff redacted]

It looks like I'm not linking something, but much googling still gave
me nothing. Any ideas?
-d-

Yes. Try asking in either an SDL or a MinGW group. Linking is beyond
the scope of this group.
 
S

soulfreshner

Problem solved, I'm posting here just in case somebody else runs into
a similar problem :

The order of the commands are important. It seems that having -o
<ouput_file_name> *first*, before the other options, solved the
problem. My command was:

g++ -o test.exe -I/mingw//include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -
L/mingw/lib -lmingw32 -lSDLmain -lSDL -lSDL_image -mwindows
sdl_blit_stuff.cpp

Thanks, dave, for pointing me in the right direction.

-d-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top