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.

Coding > GBA Appwizard causing trouble

#7567 - DiscoStew - Fri Jun 20, 2003 2:29 am

I've recently tried using the GBA Appwizard so that I can use Visual C++ 6.0 to check for errors (and also cause it's easier for me), but I just can't seem to compile anything (I use the Pern Project stuff).

Having a small problem with it actually setting the DevKitAdvance directory when making a new project since it never sets it, but I get around that by adding it myself in the MAK file.

When compiling the newly made project just to see it it runs as is, I get a bunch of errors, all different when something else is done.

First, it can't seem to find the "stdlib.h" file that it added to the project, so I copy the file from my VC98 folder into my project folder, but then it brings up this...

Code:
In file included from D:/GBAProjects/Test/Test.cpp:4:
D:/GBAProjects/Test/stdlib.h:24:2: #error ERROR: Only Mac or Win32 targets supported!
In file included from D:/GBAProjects/Test/Test.cpp:4:
D:/GBAProjects/Test/stdlib.h:77: redeclaration of C++ built-in type `wchar_t'
NMAKE : fatal error U1077: 'C:\devkitadv\bin\gcc.exe' : return code '0x1'


...So I decide to remove it from my project, then the error window shows this...

Code:
 C:\devkitadv\bin\gcc  -I C:\devkitadv\arm-agb-elf\include -I C:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\include -I D:\GBAProjects\Test -mthumb-interwork -c -g -O2 -Wall -fverbose-asm D:\GBAProjects\Test\Test.cpp
------------------------------------------
CPP-Sources Compiled
------------------------------------------
 C:\devkitadv\bin\ld -L C:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork -L C:\devkitadv\arm-agb-elf\lib\interwork -T LinkScript -o Test.elf crt0.o        crtbegin.o    crtend.o      interupt.o    Test.o -lstdc++ -lgcc -lc
/cygdrive/c/devkitadv/bin/ld: cannot find -lc
NMAKE : fatal error U1077: 'C:\devkitadv\bin\ld.exe' : return code '0x1'


First thought in my mind...If it cannot find something, then it doesn't exist, so I remove the "-lc" from the MAK file, then an extremely long list of errors pop up, such as...
undefined reference to "atexit"
undefined reference to "abort"
etc, etc, etc...

All I want to do is use it, and it won't let me. Any suggestions and/or help would be appreciated.

PS: I've tried making a project under the "C" drive along with the shown "D" drive on my computer, and the same thing happens.
_________________
DS - It's all about DiscoStew

#7570 - tepples - Fri Jun 20, 2003 3:23 am

I don't have VC++ right now, so I can't help you more than the following, but from the error message you gave, I can tell that your header paths incorrectly point to VC++'s Win32/Mac tree. They should point to DevKit Advance's tree.

The "cannot find -lc" means you're not providing the proper library paths either.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#7571 - DiscoStew - Fri Jun 20, 2003 4:29 am

The first error involving the "stdlib.h" file is weird because the GBA AppWizard added it to my project, and the only file close to that name was the file that came with Visual Studio. There was no such file in my DevKitAdvance folder.

Perhaps I should show you the MAK file that the GBA AppWizard made when I create a new project (without any changes)...

Code:

# ------------------------------------------
# Title:      Default Makefile for use in VC++
# File:          Test.mak
# Revision:     01/06/2002
#
# Author:      Benjamin D. Hale
# Orignally by:         Jaap Suter
# Contributed to by:    Christer Andersson
#
# Info:              This file is contains the make-instructions
#         for the project. Replace DEVDIR with the appropriate
#                       base directory for devkitadv. After you make the
#                       needed modifications here rename this file to
#                       <project_name>.mak so Visual C++ does not get
#                       confused.
# -------------------------------------------

# -------------------------------------------
# Project name definition makes this whole thing
# a lot easier to use. Only two total modifications
# (other than what .o files will be needed)
# should be needed to get this working with your
# compiler and Visual C++. Replace "Default" with
# your project's name.
# -------------------------------------------

PROJECT = Test

# -------------------------------------------
# Define some directories;
# -------------------------------------------

# -------------------------------------------
# Base Directory for gcc arm-agb-elf replace with
# wherever you put your gba devkitadv files.
# -------------------------------------------

DEVDIR  = ?

# -------------------------------------------
# Source directory (where your project's source files are located.)
# -------------------------------------------

SRCDIR  = D:\GBAProjects\Test\

# -------------------------------------------
# Compiler Directories for binaries, includes and libs.
# -------------------------------------------

CMPDIR  = $(DEVDIR)\bin
LIBDIR  = $(DEVDIR)\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
LIBDIR2 = $(DEVDIR)\arm-agb-elf\lib\interwork
INCDIR  = $(DEVDIR)\lib\gcc-lib\arm-agb-elf\3.0.2\include
INCDIR2 = $(DEVDIR)\arm-agb-elf\include

# -------------------------------------------
# END of directory defines
# -------------------------------------------

# -------------------------------------------
# Define what extensions we use;
# -------------------------------------------
.SUFFIXES : .cpp .c .s

# -------------------------------------------
# Define the flags for the compilers;
# -------------------------------------------
CFLAGS  = -I $(INCDIR2) -I $(INCDIR) -I $(SRCDIR) -mthumb-interwork -c -g -O2 -Wall -fverbose-asm
SFLAGS  = -I $(INCDIR2) -I $(INCDIR) -mthumb-interwork
LDFLAGS = -L $(LIBDIR) -L $(LIBDIR2) -T LinkScript

# -------------------------------------------
# Define the list of all O files;
# Just follow the syntax shown to add any
# other objects your project may need to
# compile properly. You will need to add
# files to this part to make it work with
# your project add a \ to the end of all o
# files except the last one. Like below.
# -------------------------------------------

O_FILES          = \
                   crt0.o       \
                   crtbegin.o   \
                   crtend.o     \
                   interupt.o   \
                   Test.o

# -------------------------------------------
# There should be no need to modify anything
# below here.
# -------------------------------------------

# -------------------------------------------
# Define the final dependecy;
# -------------------------------------------
all : $(PROJECT).gba

# -------------------------------------------
# Define the copy from .elf to .bin file
# -------------------------------------------
$(PROJECT).gba : $(PROJECT).elf
   $(CMPDIR)\objcopy -v -O binary $(PROJECT).elf $(PROJECT).gba
   -@echo ------------------------------------------
   -@echo Done
   -@echo ------------------------------------------
   
# -------------------------------------------
# Define the linker instruction;
# -------------------------------------------
$(PROJECT).elf : $(O_FILES)
   $(CMPDIR)\ld $(LDFLAGS) -o $(PROJECT).elf $(O_FILES) -lstdc++ -lgcc -lc 
   -@echo ------------------------------------------
   -@echo Linking Done
   -@echo ------------------------------------------

# -------------------------------------------
# Define each compile;
# -------------------------------------------
{$(SRCDIR)}.cpp.o::
   $(CMPDIR)\gcc  $(CFLAGS) $<
   -@echo ------------------------------------------
   -@echo CPP-Sources Compiled
   -@echo ------------------------------------------

{$(SRCDIR)}.c.o::
   $(CMPDIR)\gcc  $(CFLAGS) $<
   -@echo ------------------------------------------
   -@echo C-sources Compiled
   -@echo ------------------------------------------

# -------------------------------------------
# Define each assemble;
# -------------------------------------------
{$(SRCDIR)}.s.o:
   $(CMPDIR)\as $(SFLAGS) $(SRCDIR)\$*.s -o$@
   -@echo ------------------------------------------
   -@echo ASM-Sources Compiled
   -@echo ------------------------------------------
   
# -------------------------------------------
# Any problems with getting this working email
# questions to whatzdat_pimp@hotmail.com .
# This was tested on devkitadv r4 and Visual C++ 6
# on a p3 450/512mb/Windows XP Pro.
# -------------------------------------------
# EOF;



Now, I change DEVDIR to my DevKitAdvance folder. Now, I used both the Crtls and Headers from the Pern's Project as optioned in GBA AppWizard, and it added these following files...

-Source Files
--Test.cpp ------> Entry Point
--interupt.cpp
-Header Files
--gba.h
--interupt.h
--mathluts.h
-Resource Files
--Test.mak

...and my Test.cpp file has these includes as shown...
#include <gba.h>
#include "stdlib.h"
#include <mathluts.h>
#include <interupts.h>

Remember, everything I've shown here was not at all changed by me, but was created by the GBA AppWizard. Perhaps this could light up any ideas. I should expect that not everything should work as its supposed to, but why this????? AARRRRGGGHHH!!!! Perhaps I should contact the author of this.

Just a note, I'm using DevKitAdvance r4, ot the new beta.
_________________
DS - It's all about DiscoStew

#7572 - tepples - Fri Jun 20, 2003 5:08 am

DiscoStew wrote:
The first error involving the "stdlib.h" file is weird because the GBA AppWizard added it to my project, and the only file close to that name was the file that came with Visual Studio. There was no such file in my DevKitAdvance folder.

My installation of DevKit Advance R4 shows a file called C:\devkitadv\arm-agb-elf\include\stdlib.h

Quote:
Code:

# -------------------------------------------
# Any problems with getting this working email
# questions to whatzdat_pimp@hotmail.com .
# This was tested on devkitadv r4 and Visual C++ 6
# on a p3 450/512mb/Windows XP Pro.
# -------------------------------------------

Does whatzdat_pimp@h... have an account here on gbadev.org?

Quote:

...and my Test.cpp file has these includes as shown...
#include <gba.h>
#include "stdlib.h"
#include <mathluts.h>
#include <interupts.h>

Perhaps it should be #include <stdlib.h> instead of #include "stdlib.h" ?

Quote:
Perhaps I should contact the author of this.

That'd be a good idea.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#7573 - DiscoStew - Fri Jun 20, 2003 6:42 am

You are a life saver!!!!!!!!!!!

After reading your post about "stdlib.h", I went and check my own installation for that, and for some reason, I couldn't even find a "include" folder under my "C:\devkitadv\arm-agb-elf\" folder, so I reinstalled all the files of the DevKitAdvance, and now it seems to be working (at least no error right now). Thanks a lot tepples.

Why that folder wasn't there before was beyond me. I don't know who "whatzdat_pimp" is. That comment was added from the GBA AppWizard. ?????
_________________
DS - It's all about DiscoStew