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 

Header Files.

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



Joined: 27 Jan 2005
Posts: 6
Location: London/UK

PostPosted: Thu Jan 27, 2005 2:36 am    Post subject: Header Files. Reply with quote

Hi,

I'm not a C programmer and thought some ps2 dev would be the most interesting way to get into it (my last involvement in anything like this was 68000) so apologies for the v.basic question .....

I took the ee samples hello.c and compiled it using make.
Just to feel my way around i added

#include <config.h>

and the following code:

s32 a;
a = configGetLanguage();
sio_printf("Hello from EE SIO! %d\n",a);

All still compiling fine.
Now, i add a reference to the libpad header file which is in the same folder as the config header file.

#include <libpad.h>

int b;
b = padInit(0);

and get the following problem......

ee-gcc -D_EE -O2 -G0 -Wall -IC:\PS2Dev\gcc/ee/include -IC:\PS2Dev\gcc/ee/lib/gc
c-lib/ee/3.2.2/include -IC:\PS2Dev\gcc/ee/ee/include -IC:\PS2Dev\ps2lib/ee/inclu
de -IC:\PS2Dev\ps2lib/common/include -I. -c hello.c -o hello.o
ee-gcc -TC:\PS2Dev\ps2lib/ee/startup/linkfile -LC:\PS2Dev\ps2lib/ee/lib \
-nostartfiles C:\PS2Dev\ps2lib/ee/startup/crt0.o \
hello.o -lkernel -o hello.elf
hello.o(.text+0x3c): In function `main':
hello.c: undefined reference to `padInit'
collect2: ld returned 1 exit status
make: *** [hello.elf] Error 1

Help???
_________________
Darren
Back to top
View user's profile Send private message Visit poster's website
darrenjferguson



Joined: 27 Jan 2005
Posts: 6
Location: London/UK

PostPosted: Thu Jan 27, 2005 2:49 am    Post subject: Reply with quote

Don't worry,

Got it. had to add this in the makefile.

EE_LIBS = -lpad

don't understand quite why though.

:)
_________________
Darren
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Thu Jan 27, 2005 5:43 am    Post subject: Reply with quote

Including the header only tells the compiler what's inside an external library file. Its basically just a description of the interface/api. You still have to link in that library with -lpad in order to actually use it.

As an aside, is there a reason you're using ps2lib instead of ps2sdk?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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