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 > GCC/DevKit not compiling

#19760 - Quest-Master - Sun Apr 25, 2004 4:06 am

Hello. This is my first post around, so I'm hoping I'm not dissatisfying anyone with my first impression :P Ok, I have a make.bat file in the directory of my game which works perfectly fine. So I run the CMD, move to my game directory, and type in make. It then says I do not have a main.cpp file, and then main.elf. The main.cpp file is there, so I have no idea why it is not working. Here is the make.bat source in case anyone needs it:
Code:
path=C:\devkitadv\bin
gcc -o main.elf main.c -lm
objcopy -O binary main.elf main.bin

Solutions?
_________________
The child shall never love the mother as it did to the child; now and forever.

#19761 - poslundc - Sun Apr 25, 2004 4:38 am

You are using main.c in the makefile, not main.cpp.

Dan.

#19762 - DiscoStew - Sun Apr 25, 2004 4:39 am

Just when I thought I'd get to it first, heres poslundc.
Actually, he said that it works when running the make.bat file when not under cmd.
_________________
DS - It's all about DiscoStew

#19764 - sajiimori - Sun Apr 25, 2004 5:37 am

Regardless of how you run it, there's no reason that batch file would work when it's trying to compile a file that doesn't exist. It's referring to the wrong file, and it's as simple as that (assuming there aren't additional problems).

#19765 - DiscoStew - Sun Apr 25, 2004 9:55 am

If he had the main.cpp, wouldn't the error he is referring to show that "main.c" wasn't there, since that is what is being used in the batch file? Just kinda odd considering that it works one way, but not another.
Quest-Master, I know it could very well be a simple wrong extension on the Main file (and probably is), but if by chance that is not the problem, when you run the batch file from Windows, does it actually create a new BIN file? I know that unless you have a pause at the end of the batch file, and by chance anything odd happens, the DOS window will only display for a split second, and you can't really see any messages, whether good or bad, were displayed. Just a thought if the DOS window vaguely flickered on the screen. Just place the word pause by itself on the last line of the batch file, and check. Any errors will result in the BIN file not being created, and the old BIN (if it exists) will remain. Check the time created on the BIN file to is if it matches with the system clock, showing that it is new. I remember when I first started, thinking my code was compiled, and yet it looked as if no changes were made because the old one remained. I actually had my batch file delete the old file so that I wouldn't get confused again. Maybe that can help. Also, be sure to tell us if what we advise fixes it, because thinking of other possibilities when there are no more problems to fix really bums me out.
_________________
DS - It's all about DiscoStew

#19776 - poslundc - Sun Apr 25, 2004 3:01 pm

DiscoStew wrote:
If he had the main.cpp, wouldn't the error he is referring to show that "main.c" wasn't there, since that is what is being used in the batch file?


If he'd noticed that and posted that as the error, he probably would've figured it out for himself. :P

Dan.

#19783 - Quest-Master - Sun Apr 25, 2004 4:05 pm

Seems that it was VHAM that was messing it up. I was using it as my IDE (and compiling it through there too) so it must've screwed stuff up. I removed all of the files it had created (a bunch of useless junk, that is) and redid the whole thing and it works now. I also added the pause there to see if it works (the make.bat) and it does. Thanks guys :)
EDIT: Oh, and about what pos said (that I had put main.c and I had written main.cpp for the make), that was just a mistake of mine in the post :P
_________________
The child shall never love the mother as it did to the child; now and forever.