gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > I need gcc for idiots - need help

#16658 - 628man - Sun Feb 22, 2004 5:02 am

Hello,

Before I get into my questions, here's some quick background info: I started using HAM but wasn't satisfied and stopped using the lib altogether. Then I was still compiling my own programs with the Win32 HAM IDE, but it slows down my system too much and I decided to move on.

So I decompressed and started DevKit Advance properly on Win2k, hoping I'd get a basic framework built-up for using with an IDE. Unfortunately, it's been 8 years since I've even touched GCC in a text shell and I have no idea what to do. No makefile I created ever seemed to work. So I tried manually running gcc from the shortcut and it still fails. GCC won't even "find" gba.h in the same directory as the other source files or the include directory! I've taken makefile examples and converted them to my directories and nothing works.

my paths and environment variables look correct.

What I need help with--

I'd like to know how I can get this to work possibly from the command line (or is it too complicated to be reasonable?) or some help with gcc and make like a site with important switch explanations. None of my directories seem to be working...not even the directory I'm compiling from!

example:
Code:
gcc main.c rand.c -o output.elf

produces:
Code:

main.c:8:17: gba.h: No such file or directory
(hundreds of additional errors)


somebody help a DKA newbie out with a working makefile or something? I've been stuck on this for days. PS: I know I will need to link files and hook interrupts, compile both ARM and THUMB modes, etc. I'm not very good at navigating complexity.

#16660 - DekuTree64 - Sun Feb 22, 2004 5:15 am

Do you have a gba.h? If not you'll need to find/make one. It's usually just a lot of defines for all the GBA's registers and the typedefs for the u32/s32/u16 etc. types and such. Download pretty much any game or demo with source and you'll find one, or check the CowBite spec or GBATEK for the reg addresses and waste some time typing it yourself.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#16662 - 628man - Sun Feb 22, 2004 5:18 am

That's what I don't understand...gba.h is in the same directory as the other files. It's also in the include directory F:\gba\devkitadv-r5-beta-3\include

#16672 - yaustar - Sun Feb 22, 2004 1:45 pm

Shouldn't it be?:
Code:
gcc -o main.c rand.c output.elf

Or does it not matter?
_________________
[Blog] [Portfolio]

#16678 - tepples - Sun Feb 22, 2004 4:28 pm

The -o has to immediately precede the name of the ELF file (e.g. -o output.elf).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#16688 - 628man - Sun Feb 22, 2004 8:43 pm

I pulled the gba.h include directive out of system brackets (<>) and into quotes and it works now, but I'd still like to get the primary system include directories working eventually.

So, it's now back to trying to get a decent, simple, generic makefile to work that will fill in options such as that.

#16700 - dagamer34 - Mon Feb 23, 2004 3:25 am

Or you can just grab one from one of the demos at the Pern Project.
_________________
Little kids and Playstation 2's don't mix. :(

#16771 - 628man - Tue Feb 24, 2004 8:19 pm

Pern project is nice, but anything I don't do myself would end up being confusing if there were a problem (like I've had with other makefile's I've borrowed) need to make my own to understand it, and did.

This page has most of the useful GCC options. Comparing it with other makefiles has proved helpful:

http://gcc.gnu.org/onlinedocs/gcc-3.3.3/gcc/Option-Summary.html#Option%20Summary

And I thought GCC was archaic and difficult to use in 1996...