GP32 Handling '.a' files - Strange problem


ConsoleTom

Member
Joined
Dec 4, 2003
Messages
106
Age
48
Location
Germany
Website
Visit site
Hi !

I have two programs that need the libraries libgpfont16.a and libgpgraphic16.a. I include gpfont16.h and gpgraphics16.h in the gpmain file.

Strange is that the declarations in MAKEFILE 1 do not work while they do in MAKEFILE 2.

When i call the function GpFontInit16 GCC (in the program of Makefile 1) says undefined referrence. What's wrong - anyone an idea ? Does it depend on these flags perhaps ?

%.o: %.cpp
$(CC) $(CPPFLAGS) -c $< -o $@

Thanks in advance.

Tobias



MAKEFILE 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

# devkitadv base dir
export CCBASE=c:/devkitadv
# User options passed to the compiler
export CUSER=-DGP32 -ansi
include $(CCBASE)/gp32.mk
#------------------------------

%.o: %.cpp
$(CC) $(CPPFLAGS) -c $< -o $@

# --------------------------------------------------------------------
SRC = susie.cpp mikie.cpp rom.cpp ram.cpp cart.cpp system.cpp memmap.cpp gpmain.cpp
OBJS = $(SRC:%.cpp=%.o)
# --------------------------------------------------------------------

all: handygp.fxe

handygp.fxe: handygp.elf

handygp.elf: $(OBJS) ASMScreenUpdate.o libgpfont16.a libgpgraphic16.a
$(LINK)

clean:
rm -f handygp.elf handygp.fxe $(OBJS)

MAKEFILE 2 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

# devkitadv base dir
export CCBASE=c:/devkitadv
# User options passed to the compiler
export CUSER=-DLITTLE_ENDIAN -DGP32 -W -Wall -ansi -pedantic
include $(CCBASE)/gp32.mk
#------------------------------

all: gfxtest.fxe

gpmain.o: gpmain.c

gfxtest.elf: gpmain.o test.o libgpfont16.a libgpgraphic16.a
$(LINK)

gfxtest.fxe: gfxtest.gxb

clean:
del gfxtest.gxb gfxtest.fxe gfxtest.elf gpmain.o

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
"Undefined references" usually happen because of include order. First of all, check gp32.mk if you are using devkitadv. Look for the line which deals with including the various GP32 libraries and include your libraries there, before the various object files from a project makefile are linked.
 
Back
Top