including libraries to GCC project in a makefile

Started by
2 comments, last by Benjamin Heath 19 years, 4 months ago
Hi. this is my make.bat:
path=c:\devkitadv\bin
gcc -o %1.elf %1 -lm c:\pex\gbademo\gba.a
objcopy -O binary %1.elf %1.gba
c:\visualboy\VisualBoyAdvance.exe %1.gba
where %1 is main.c im trying to create the main.c.gba but GCC says "undefined reference to 'drawSquare'" in Dev-Cpp, when i wrote in Project Options->Parameters->Linker: –lm ../GBAEngine/GBAEngine.a (its the same library) i dont get an error at all, so i copy-pasted –lm and i find out that the -lm in make.bat is a simple - but the -lm in Dev-Cpp uses a longer -, which i cant use in DOS. when i use the longer - in make.bat, i get following error: "gcc: ulm: No such file or directory" where u is some europian u with a triangle on it. what should i write? thanks, pex. [Edited by - pex22 on December 3, 2004 3:24:44 PM]
pex.
Advertisement
Quote:Original post by pex22
Hi.
this is my make.bat:
path=c:\devkitadv\bingcc -o %1.elf %1 -lm c:\pex\gbademo\gba.aobjcopy -O binary %1.elf %1.binc:\visualboy\VisualBoyAdvance.exe %1.gba

where %1 is main.c
im trying to create the main.c.gba but GCC says "undefined reference to 'drawSquare'"
in Dev-Cpp, when i wrote in Project Options->Parameters->Linker:
–lm ../GBAEngine/GBAEngine.a
(its the same library)
i dont get an error at all, so i copy-pasted –lm and i find out that the -lm in make.bat is a simple -
but the -lm in Dev-Cpp uses a longer -, which i cant use in DOS.
when i use the longer - in make.bat, i get following error:
"gcc: ulm: No such file or directory"
where u is some europian u with a triangle on it.
what should i write?

thanks,
pex.
Okay I want to help you, but I need to get some things clear first. So you're using a tool set called devkitadv for GBA development. It includes a port of GCC with various libraries and other programs. You've written a batch script to compile your game, and you're getting a rather classic compilation error. Is that correct?
yep
i use the GCC from devkitadv and drawSquare is inside GBAEngine.a
pex.
Quote:Original post by pex22
yep
i use the GCC from devkitadv and drawSquare is inside GBAEngine.a
Sorry for the long wait.

From your sample batch script, you're not linking with GBAEngine.a. You only state gba.a, and I can only assume these are separate libraries. Try linking with both.

This topic is closed to new replies.

Advertisement