Page 1 of 1

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

Posted: Sat Mar 01, 2008 4:06 am
by Fling
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);

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

Posted: Sat Mar 01, 2008 11:00 am
by WinterMute
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.

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

Posted: Sat Mar 01, 2008 2:42 pm
by Fling
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!