| View previous topic :: View next topic |
| Author |
Message |
71M
Joined: 21 Jun 2005 Posts: 122 Location: London
|
Posted: Mon Aug 01, 2005 6:39 am Post subject: Creating a PSP Library |
|
|
Hi,
I'm having problems creating a lib file for the PSP.
The library compiles and creates a .a file, but when I try and link the lib into my project I get an 'undefined reference to...' error.
www.easy-monkey.co.uk/libtest.rar
Hope somebody can help me figure this one out.
Thanks,
71M |
|
| Back to top |
|
 |
71M
Joined: 21 Jun 2005 Posts: 122 Location: London
|
Posted: Mon Aug 01, 2005 10:55 pm Post subject: |
|
|
Alternatively does anyone have an example of a simple library that works?
I've successfully compiled and linked in libpng and zlib, but can't see any differences between those library definitions and the ones I've created.
Cheers,
71M |
|
| Back to top |
|
 |
rinco
Joined: 21 Jan 2005 Posts: 255 Location: Canberra, Australia
|
Posted: Mon Aug 01, 2005 11:32 pm Post subject: |
|
|
links fine for me... -L. -ltest
but i have to wonder why you've declared the function as external. |
|
| Back to top |
|
 |
71M
Joined: 21 Jun 2005 Posts: 122 Location: London
|
Posted: Mon Aug 01, 2005 11:39 pm Post subject: |
|
|
| rinco wrote: | links fine for me... -L. -ltest
but i have to wonder why you've declared the function as external. |
I've managed to find the problem.
I bet you're linking the lib into a C project. Trying to link it into a C++ project throws up the errors.
By changing the header to this -
| Code: | #ifdef __cplusplus
extern "C"
{
#endif
int TestFunction();
#ifdef __cplusplus
}
#endif
|
It links correctly!
I shoulda guessed this one!!!
Thanks for all your help.
Cheers,
71M |
|
| Back to top |
|
 |
elevationsnow
Joined: 10 Sep 2005 Posts: 22
|
Posted: Mon Sep 12, 2005 1:57 am Post subject: |
|
|
| could you tell me how you succefully installed libpng im using cygwin and it just doesnt want to install |
|
| Back to top |
|
 |
liquid8d
Joined: 30 Jun 2005 Posts: 66
|
Posted: Tue Sep 13, 2005 2:16 pm Post subject: |
|
|
taken from this post:
http://forums.ps2dev.org/viewtopic.php?t=3112&postdays=0&postorder=asc&start=0
----------------------
in your Cygwin Bash Shell (or whatever you use) enter the folowing lines;
svn co svn://svn.ps2dev.org/psp/trunk/zlib -- press [Enter] and wait for the prompt to show back up.
svn co svn://svn.ps2dev.org/psp/trunk/libpng -- press [Enter] and wait for the prompt to show back up.
[Edit] Those two lines up just above this look like links to websites, but they're not, so don't even bother clicking on them.
then you need to change your directory in the bash shell to your psptoolchain/zlib folder, and then type 'make' and then 'make install'
then change the directory over to your psptoolchain/libpng folder and type 'make' and 'make install' again.
You need to include png.h and you need to add the following to your makefile;
Code:
LIBS = -lpng -lz
----------------------------
LiQuiD8d |
|
| Back to top |
|
 |
|