libogc: (wii) gu.c:(.text.guPerspective+0x44): undefined ref

Post Reply
Fling
Posts: 3
Joined: Wed Nov 07, 2007 11:14 pm

libogc: (wii) gu.c:(.text.guPerspective+0x44): undefined ref

Post by Fling » Sat Mar 01, 2008 4:06 am

guPerspective works fine for GameCube projects, but as soon as you switch it to a Wii project makefile you get this:

Code: Select all

E:\devkitPro\examples\wii\template>make
template.c
linking ... template.elf
e:/devkitPro/libogc/lib/wii\libogc.a(gu.o): In function `guPerspective':
gu.c:(.text.guPerspective+0x44): undefined reference to `tanf'
collect2: ld returned 1 exit status
make[1]: *** [/e/devkitPro/examples/wii/template/template.elf] Error 1
make: *** [build] Error 2
My simple test case was to take the "template" Wii example project and add this:

Code: Select all

	Mtx projection;
	guPerspective(projection, 60, 1.33F, 10.0F,	300.0F);

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: libogc: (wii) gu.c:(.text.guPerspective+0x44): undefined ref

Post by WinterMute » Sat Mar 01, 2008 11:00 am

This isn't really a bug as such, the template doesn't use libm so it wasn't added to the libraries in there. I might as well just add it to the template though, it's likely that most cube/wii code will be using libm functions eventually. Just add -lm to the LIBS line in the makefile like this :-

Code: Select all

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-logc -lm
You also might like to know that most, if not all, of the current gamecube examples will build for Wii merely by changing the rules file included at the top. Just change the include from $(DEVKITPPC)/gamecube_rules to $(DEVKITPPC)/wii_rules and the build system takes care of the rest.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Fling
Posts: 3
Joined: Wed Nov 07, 2007 11:14 pm

Re: libogc: (wii) gu.c:(.text.guPerspective+0x44): undefined ref

Post by Fling » Sat Mar 01, 2008 2:42 pm

WinterMute wrote:This isn't really a bug as such, the template doesn't use libm so it wasn't added to the libraries in there.
Yeah, sorry about that, wasn't sure as I was posting if this was the right forum for it.

Anyway, thanks for the quick solution!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests