| View previous topic :: View next topic |
| Author |
Message |
Apollo
Joined: 05 Mar 2006 Posts: 10
|
Posted: Mon Mar 06, 2006 5:31 am Post subject: A seemingly simple problem |
|
|
I see under ps2dev/ee/ee/include that there is a math.h file, but when I include this and try to use the sin and cos functions I get this error.
| Code: | obj/spiral.o(.text+0x90): In function `spiral':
spiral.c: undefined reference to `litodp'
obj/spiral.o(.text+0x98):spiral.c: undefined reference to `cos'
obj/spiral.o(.text+0xa0):spiral.c: undefined reference to `dptofp'
obj/spiral.o(.text+0xac):spiral.c: undefined reference to `litodp'
obj/spiral.o(.text+0xb4):spiral.c: undefined reference to `sin'
obj/spiral.o(.text+0xbc):spiral.c: undefined reference to `dptofp'
collect2: ld returned 1 exit status
make: *** [spiral.elf] Error 1 |
I'm new to the ps2 and all I am making is a simple rotating hypnotic spiral. Any ideas why the functions won't work? |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Mon Mar 06, 2006 7:01 am Post subject: |
|
|
You need to link with libm.
In other words, you need to add -lm to the EE_LIBS line the makefile. _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
Apollo
Joined: 05 Mar 2006 Posts: 10
|
Posted: Tue Mar 07, 2006 12:49 pm Post subject: |
|
|
| That brought about a ton of more errors. I am using the binary sdk of the website. I'm going to download the cygwin toolchain tonight and maybe that will help. Thanks for the response. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Tue Mar 07, 2006 12:53 pm Post subject: |
|
|
Linking order DOES matter _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
Apollo
Joined: 05 Mar 2006 Posts: 10
|
Posted: Wed Mar 08, 2006 7:38 am Post subject: |
|
|
Is this correct?
| Code: | spiral.elf: $(C_OBJ) $(S_OBJ)
@echo "-------------------------------------------------"
$(CC) $(CFLAGS) -Tlinkfile -o spiral.elf $(C_OBJ) $(S_OBJ) -lm -Wl,-Map,spiral.map |
|
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Wed Mar 08, 2006 9:25 am Post subject: |
|
|
Eww.. you might want to look at the sample makefiles... There should be numerous libraries being linked, and I don't see where any of them are being added... _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
Apollo
Joined: 05 Mar 2006 Posts: 10
|
Posted: Wed Mar 08, 2006 11:03 am Post subject: |
|
|
| I'm going off of dreamtime's demos. I'll try to look at other examples. |
|
| Back to top |
|
 |
Apollo
Joined: 05 Mar 2006 Posts: 10
|
Posted: Wed Mar 08, 2006 2:41 pm Post subject: |
|
|
| Any hints would be greatly appreciated though. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Wed Mar 08, 2006 3:10 pm Post subject: |
|
|
I'm using a modified version of the sample makefiles included with ps2sdk.
You should probably have something like '-lm -lc -lkernel -lsyscall -lc' _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
jbit Site Admin

Joined: 28 May 2005 Posts: 293 Location: København, Danmark
|
Posted: Thu Mar 09, 2006 2:11 am Post subject: |
|
|
| By the way, libmf (part of ps2sdk) is supposed to be faster than libm (part of newlib), so you might want to use that. |
|
| Back to top |
|
 |
evilo

Joined: 22 Apr 2004 Posts: 230
|
Posted: Thu Mar 09, 2006 4:09 am Post subject: |
|
|
duh... I wasn't aware of that !! I MUST test it ASAP !
thanks for the tip :) |
|
| Back to top |
|
 |
|