forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linker errors after adding new library

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ColdPie



Joined: 31 Dec 2005
Posts: 2

PostPosted: Sat Dec 31, 2005 12:38 pm    Post subject: Linker errors after adding new library Reply with quote

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
View user's profile Send private message AIM Address
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Sat Dec 31, 2005 7:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
ColdPie



Joined: 31 Dec 2005
Posts: 2

PostPosted: Thu Jan 05, 2006 10:56 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Fri Jan 06, 2006 3:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Martyburns



Joined: 21 Feb 2006
Posts: 1

PostPosted: Tue Feb 21, 2006 6:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Gan Quan



Joined: 18 Sep 2006
Posts: 5

PostPosted: Mon Sep 18, 2006 6:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Mon Sep 18, 2006 7:36 pm    Post subject: Reply with quote

Make sure you're linking in this order:

LIBS = -lmad -lpspaudiolib -lpspaudio
Back to top
View user's profile Send private message
Gan Quan



Joined: 18 Sep 2006
Posts: 5

PostPosted: Mon Sep 18, 2006 8:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group