Sign in to follow this  
Thomas Bartholemew

Undifines reference errors in Dev-C++

Recommended Posts

Hi there, any help on this would be really appreciated....I am trying to compile some simple code on Dev-C++ but are getting lots of Linker errors. Here are a few lines from the compiler: [Linker error] undefined reference to `IMG_Load' [Linker error] undefined reference to `Mix_LoadMUS' [Linker error] undefined reference to `Mix_LoadWAV_RW' [Linker error] undefined reference to `TTF_Quit' [Linker error] undefined reference to `Mix_PlayChannelTimed' I have the Libraries properly in place, and have put this: -lmingw32 -lSDLmain -lSDL into the project options under parameters, Linker. Anyone know what I'm doing wrong here? Thanks very much.

Share this post


Link to post
Share on other sites
Those errors indicate that you're using functions from SDL_Image, SDL_ttf and SDL_mixer, but you aren't linking against those libraries. Add the libraries to your linker settings.

Share this post


Link to post
Share on other sites
You need to add -lSDL_mixer, -lSDL_ttf and -lSDL_image to the libraries section. -lSDL only includes the main SDL library. You may also need to download those libraries if you don't already have them.

Share this post


Link to post
Share on other sites
Thanks very much, that's sorted it! There is just one more error I'm gettong which is this:

C:\Documents and Settings\Desktop\Tom TD Dev Proj\Makefile.win [Build Error] ["Tom] Error 1

I think it relates to the directoris of certain files but as long as every file associated with your project is in the same folder, the build should work right?

Thanks

Share this post


Link to post
Share on other sites
I have just also looked at the compile log which says this:

Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Tim\Desktop\Tom TD Dev Proj\Makefile.win"
Executing make...
make.exe -f "C:\Documents and Settings\Tim\Desktop\Tom TD Dev Proj\Makefile.win" all
g++.exe Untitled1.o -o "Tom TD Dev Proj.exe" -L"C:/Dev-Cpp/lib" -mwindows -lmingw32 -lSDLmain -lSDL SDL_Image SDL_ttf SDL_mixer

g++.exe: SDL_Image: No such file or directory
g++.exe: SDL_ttf: No such file or directory
g++.exe: SDL_mixer: No such file or directory

make.exe: *** ["Tom] Error 1

Execution terminated

Any help would be much appreciated, Thanks.

Share this post


Link to post
Share on other sites
Browse to the folder C:/Dev-Cpp/lib. Can you see SDL_ttf, SDL_mixer and SDL_image library files there (they may have the extension .a or .lib). If not, you'll need to follow the advice you got here to retrieve them.

Share this post


Link to post
Share on other sites
in your linker settings

SDL_Image SDL_ttf SDL_mixer

should be

-lSDL_Image -lSDL_ttf -lSDL_mixer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this