Public Group

# including libraries to GCC project in a makefile

This topic is 4972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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]

##### Share on other sites
Quote:
 Original post by pex22Hi.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.gbawhere %1 is main.cim 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?

##### Share on other sites
yep
i use the GCC from devkitadv and drawSquare is inside GBAEngine.a

##### Share on other sites
Quote:
 Original post by pex22yepi 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.

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 39
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631717
• Total Posts
3001877
×