This linker problem is killing me

Started by
2 comments, last by Concentrate 12 years, 11 months ago
I just want to program is that too much to ask for? I'm trying to link SDL_mixer into eclipse C++ on my mac. I get bunch of undefined reference for SDL_mixer functions. Please anyone able to help, help!!!

regards, D.chhetri
Edge cases will show your design flaws in your code!
Visit my site
Visit my FaceBook
Visit my github
Advertisement
I can't particularly help you with your question, but you should know you're not likely to get much help with such a vague problem description.

Put up the exact errors you get, and describe the steps you have taken so far to link, maybe you'll get more help that way.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game

I can't particularly help you with your question, but you should know you're not likely to get much help with such a vague problem description.

Put up the exact errors you get, and describe the steps you have taken so far to link, maybe you'll get more help that way.


Thanks.

The errors :

Undefined symbols:

"_Mix_PauseMusic", referenced from:

handleEvent(SDL_Event const&)in main.o

"_Mix_FreeMusic", referenced from:

_SDL_main in main.o

"_Mix_OpenAudio", referenced from:

_SDL_main in main.o

"_Mix_CloseAudio", referenced from:

_SDL_main in main.o

"_Mix_LoadMUS", referenced from:



//...and so on






The steps I took to link SDL_mixer on eclipse C++ on my mac OS X




1) Download SDL_mixer.dmg

2) Included it inside SDL.framework which is located in my system/library/frameworks

3) In Eclipse, I went to Project->properties, under GCC C++ compiler -- Includes , I added the SDL_mixer.h directory

4) Test run, I get undefined reference errors[ logical since it does not know where to find its definition ]




Right now I'm trying to add SDL_mixer executable[ which I assume is the .lib file ] that is located in system/library/frameworks/SDL.frameworks/SDL_mixer.frameworks/

but I'm getting no luck. It shouldn't be complicated to add external libraries, but somehow I'm making it as if it were.

Edge cases will show your design flaws in your code!
Visit my site
Visit my FaceBook
Visit my github
Wow I got it, and it was soo stupid. I inserted SDL_mixer.framework inside of SDL.framework just so I could have it in the same director but that caused some problem I guess. So I added SDL_mixer.framework in the same directory as SDL.framework and not inside SDL.framework and now it works. So in all these are the steps I took to link SDL_mixer in eclipse C++ on MAC OS X

1) Download SDL_mixer.dmg for mac
2) Now copy or transfer the SDL_mixer.framework folder into the directory /System/libraries/Frameworks/
3) Now in eclipse go into Project->preference
4) Under C/C++ Build , Under Settings , click on the Miscellaneous tab
5) In the Linker Flags add "-framework SDL_mixer" without the quotes. This should be where you have -framework SDL as well
6) Now under GCC C++ compiler section, under 'includes'
- add the directory where your SDL_mixer.framework is[ if you followed step 1, it should be something like "/System/Library/Frameworks/SDL_mixer.framework" ]
- add the directory where SDL_mixer.h is located, it will be something like "/System/Library/Frameworks/SDL.framework/SDL_mixer.framework/Versions/A/Headers" if you followed step 1

7) Now the headers and frameworks are setup, you should have no linkage errors


I wrote the above step for reference for other people in the future, as I know sometimes linkage problems give so much trouble.

Thanks and regards, D.Chhetri
Edge cases will show your design flaws in your code!
Visit my site
Visit my FaceBook
Visit my github

This topic is closed to new replies.

Advertisement