D+Ubuntu+SDL_image said undefined reference

alisue alisue.seiga at gmail.com
Tue Dec 29 11:45:59 PST 2009


Hi. I'm new to D and I tried to use D with SDL_image(actually SDL_mixer as well) but it doesn't work.

I used SDL header of D on "D - porting (http://shinh.skr.jp/d/porting.html)" and I could build simple SDL application(Only using SDL, not with SDL_image) in Ubuntu. However when I use SDL_image or SDL_mixer, i got message like below:
--------------------------------------------------------------------------
$ gdc -c hello.d -ISDL
$ gdc -ohello hello.o -lSDL -lSDL_image
hello.o: In function `_Dmain':
hello.d:(.text+0x54): undefined reference to `IMG_GetError'
hello.d:(.text+0x159): undefined reference to `SDL_BlitSurface'
collect2: ld returned 1 exit status
--------------------------------------------------------------------------

The message said 'IMG_GetError/SDL_BlitSurface' doesn't defined in lib however when I use C++, I could compile and run the program. And when I commented out 'IMG_GetError' and 'SDL_BlitSurface' in my source code, I could compile even I use 'IMG_Load' function which is in SDL_image :-(

How can I fix this program. I have no idea. Can anyone help me? thanks.

Env:
  Ubuntu 9.10 32bit & 64bit
  gdc 4.2.4
Installed:
  libsdl-1.2-dev
  libsdl-image1.2-dev

p.s.
I could build them on Mac OS X Snow Leopard with DMD. Using SDL.framework and SDL_image.framework.



More information about the Digitalmars-d mailing list