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 

Math.h problem

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



Joined: 03 Nov 2005
Posts: 54

PostPosted: Mon Nov 14, 2005 10:18 am    Post subject: Math.h problem Reply with quote

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
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon Nov 14, 2005 10:39 am    Post subject: Reply with quote

Search on library link order, and begin-group, end-group.
Back to top
View user's profile Send private message
fullerlee



Joined: 03 Nov 2005
Posts: 54

PostPosted: Mon Nov 14, 2005 11:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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