Header Files.

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
darrenjferguson
Posts: 6
Joined: Thu Jan 27, 2005 2:27 am
Location: London/UK
Contact:

Header Files.

Post by darrenjferguson »

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
darrenjferguson
Posts: 6
Joined: Thu Jan 27, 2005 2:27 am
Location: London/UK
Contact:

Post by darrenjferguson »

Don't worry,

Got it. had to add this in the makefile.

EE_LIBS = -lpad

don't understand quite why though.

:)
Darren
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

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?
Post Reply