| View previous topic :: View next topic |
| Author |
Message |
ColdPie
Joined: 31 Dec 2005 Posts: 2
|
Posted: Sat Dec 31, 2005 12:38 pm Post subject: Linker errors after adding new library |
|
|
Hello.
I'm trying to add audio to my PSP game. I grabbed the MP3 codec header & source files from the PSP Media Center project (suggested by the FileAssistant++ crew) and molded it to fit my sources. Since the MP3 codec files make use of the MAD (mpeg audio decoder) libraries, I grabbed and installed those to my PSPSDK directories, too. I also added the library to my makefile. Everything compiles fine, but when it tries to link mp3player.o with the MAD libraries, I get the following error:
| Code: | | undefined reference to '<function>' |
for every MAD function that the mp3player uses.
Because the linker doesn't give any "file not found" errors, I'm pretty sure MADlib is installed correctly. It seems like it just skips the -lmad line. I've tried a lot of things, including recompiling MAD with a few different ./configure options, but nothing seems to work.
Any suggestions or ideas are welcome!
Thanks. |
|
| Back to top |
|
 |
sandberg
Joined: 05 Oct 2005 Posts: 90 Location: Denmark
|
Posted: Sat Dec 31, 2005 7:48 pm Post subject: |
|
|
Remember that the order of the -l arguments in your makefile matters. So you need to have the -lmad directive in the right place.
So
| Code: |
-lmad -lsomemp3library
|
is not the same as
| Code: |
-lsomemp3library -lmad
|
_________________ Br, Sandberg |
|
| Back to top |
|
 |
ColdPie
Joined: 31 Dec 2005 Posts: 2
|
Posted: Thu Jan 05, 2006 10:56 am Post subject: |
|
|
| sandberg wrote: | | Remember that the order of the -l arguments in your makefile matters. So you need to have the -lmad directive in the right place. |
Yes, I've tried that. I'm still stuck after a few days of messing with various makefile options. mad.h is included fine, the whole program compiles fine, but it can't link to libmad. Does anyone else have any suggestions? I'll be happy to provide more info, just let me know what you need. If you want to email me, feel free (coldpies@gmail.com) |
|
| Back to top |
|
 |
sandberg
Joined: 05 Oct 2005 Posts: 90 Location: Denmark
|
Posted: Fri Jan 06, 2006 3:12 am Post subject: |
|
|
| ColdPie wrote: | | sandberg wrote: | | Remember that the order of the -l arguments in your makefile matters. So you need to have the -lmad directive in the right place. |
Yes, I've tried that. I'm still stuck after a few days of messing with various makefile options. mad.h is included fine, the whole program compiles fine, but it can't link to libmad. Does anyone else have any suggestions? I'll be happy to provide more info, just let me know what you need. If you want to email me, feel free (coldpies@gmail.com) |
You can try to take a look at the makefile for PSPRadio. We use the mad library for MP3 as well. You can find the sources for PSPRadio from the link below.
http://svn.berlios.de/svnroot/repos/pspradio/trunk/PSP/
The makefile can be found in PSPRadio/Makefile _________________ Br, Sandberg |
|
| Back to top |
|
 |
Martyburns
Joined: 21 Feb 2006 Posts: 1
|
Posted: Tue Feb 21, 2006 6:04 pm Post subject: |
|
|
Hey,
I am having this same issue. No complaint about finding the library but cannot reference functions in it.
Did you get anywhere with this?
I have ensured that my makefile is similar to the PSPRadio one, and cannot see anything else that should be causing this.
I am guessing there is a problem with the build/insatllation of the mad lib,
but it also appears OK as it built and installed libmad.a file to C:\cygwin\usr\local\pspdev\psp\lib\ as expected.
I am stuck and any help would be appreciated. |
|
| Back to top |
|
 |
Gan Quan
Joined: 18 Sep 2006 Posts: 5
|
Posted: Mon Sep 18, 2006 6:55 pm Post subject: |
|
|
I've just donwloaded libmad from the svn repository, installed it, and tried to build a test program, the same problem poped up.
The code is compiled just fine, but the linker throws out "undefined reference to function" errors for each function of libmad.
It's been a long time since ColdPie posted this problem, I'm wondering if there is a solution? Any input would be appreciated. |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Mon Sep 18, 2006 7:36 pm Post subject: |
|
|
Make sure you're linking in this order:
LIBS = -lmad -lpspaudiolib -lpspaudio |
|
| Back to top |
|
 |
Gan Quan
Joined: 18 Sep 2006 Posts: 5
|
Posted: Mon Sep 18, 2006 8:09 pm Post subject: |
|
|
| Insert_witty_name wrote: | Make sure you're linking in this order:
LIBS = -lmad -lpspaudiolib -lpspaudio |
Thanks!! it works now!!
For people who encountered this problem (and, new to unix c programming, having no clue about writing Makefiles, like me), I just added "LIBS = -lmad -lpspaudiolib -lpapaudio" in my Makefile. |
|
| Back to top |
|
 |
|