| View previous topic :: View next topic |
| Author |
Message |
fullerlee
Joined: 03 Nov 2005 Posts: 54
|
Posted: Mon Nov 14, 2005 10:18 am Post subject: Math.h problem |
|
|
Hi,
I'm trying to use atan2, cos and sin.
I have the -lm flag set, and lib path seems to be pointing to the right place (there is a libm.a there).
At link time, I'm getting:
main.c:(.text+0x954): undefined reference to `atan2'
main.c:(.text+0x968): undefined reference to `cos'
main.c:(.text+0x99c): undefined reference to `sin'
I've searched, but haven't found a definitive answer beyond setting the -lm flag.
Can anyone help?
Thanks,
Lee
Makefile:
| Code: |
TARGET = hello
OBJS = main.o pg.o
CFLAGS = -O2 -G0 -Wall -lm
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -lm
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = tactest
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)\lib\build.mak
|
Last edited by fullerlee on Mon Nov 14, 2005 11:09 am; edited 1 time in total |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Mon Nov 14, 2005 10:39 am Post subject: |
|
|
| Search on library link order, and begin-group, end-group. |
|
| Back to top |
|
 |
fullerlee
Joined: 03 Nov 2005 Posts: 54
|
Posted: Mon Nov 14, 2005 11:16 am Post subject: |
|
|
Thanks, you pointed me in the right direction.
My makefile didn't have a LIBS section.
The fixed Makefile looks like this:
| Code: |
TARGET = hello
OBJS = main.o pg.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = tactest
LIBS = -lm -lc
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)\lib\build.mak
|
|
|
| Back to top |
|
 |
|