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 > error while compiling

#150933 - coolalien - Fri Feb 15, 2008 1:13 pm

every time i try to make any of the examples i get the same error. the error is

C:\devkitPro\examples\nds\Graphics\2D\hello_world>make
main.cpp
arm-eabi-g++ -MMD -MP -MF /c/devkitPro/examples/nds/Graphics/2D/hello_world/buil
d/main.d -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast
-math -mthumb -mthumb-interwork -I/c/devkitPro/examples/nds/Graphics/2D/hello_wo
rld/include -I/c/devkitPro/examples/nds/Graphics/2D/hello_world/build -IC:\devki
tPro\examples\nds\Graphics\2D\hello_world/libnds/include -IC:\devkitPro\examples
\nds\Graphics\2D\hello_world/libnds/include -I/c/devkitPro/examples/nds/Graphics
/2D/hello_world/build -DARM9 -fno-rtti -fno-exceptions -c /c/devkitPro/examples/
nds/Graphics/2D/hello_world/source/main.cpp -o main.o
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:31:17: warning
: nds.h: No such file or directory
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp: In function '
int main()':
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:46: error: 'to
uchPosition' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:46: error: exp
ected `;' before 'touchXY'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:48: error: 'ir
qInit' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:49: error: 'IR
Q_VBLANK' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:49: error: 'ir
qSet' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:50: error: 'ir
qEnable' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:51: error: 'vi
deoSetMode' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:52: error: 'MO
DE_0_2D' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:52: error: 'DI
SPLAY_BG0_ACTIVE' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:52: error: 'vi
deoSetModeSub' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:53: error: 'VR
AM_C_SUB_BG' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:53: error: 'vr
amSetBankC' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:55: error: 'SU
B_BG0_CR' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:55: error: 'BG
_MAP_BASE' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:57: error: 'BG
_PALETTE_SUB' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:57: error: 'RG
B15' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:60: error: 'u1
6' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:60: error: exp
ected primary-expression before ')' token
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:60: error: exp
ected primary-expression before ')' token
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:60: error: 'co
nsoleInitDefault' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:68: error: 'sw
iWaitForVBlank' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:69: error: 'to
uchXY' was not declared in this scope
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:69: error: 'to
uchReadXY' was not declared in this scope
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

Ive looked through some other topics but i can't find the answer.
Whats wrong with it.

#150944 - gmiller - Fri Feb 15, 2008 6:17 pm

The include directives are not set up to find nds.h file. I would find that file and make sure there is a -I/c/path_to_the_NDS.H/File when you build this. Remember that the tools operate on unix style path names so format them appropriately.

#150947 - Dwedit - Fri Feb 15, 2008 7:04 pm

Double check your environment variables.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#150987 - coolalien - Sat Feb 16, 2008 12:37 pm

ive fixed the first bit now. i didn't put the path in on the nds.h file so it couldn't find any of the others. It now just has this error:

C:\devkitPro\examples\nds\Graphics\2D\hello_world>make
linking hello_world.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/bin/ld
.exe: cannot find -lnds9
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/nds/Graphics/2D/hello_world/hello_world.elf]
Error 1
make: *** [build] Error 2

#150996 - gmiller - Sat Feb 16, 2008 5:11 pm

Now it can't find the library nds9 which should be libnds9.a as a file if it exists. The library search paths are specified by the -L (upper case L) directive in the linking command.

#150999 - coolalien - Sat Feb 16, 2008 7:37 pm

so how do i fix this?

#151002 - gmiller - Sat Feb 16, 2008 9:17 pm

Well if the library does not exist you need to remove the reference from the makefile. If it does exist then you need to fix your makefile to search the folder that has the file in it for linking. This means that if the file is in /c/devkitAdvance/libs you need to have a -L/c/devkitAdvance/libs in your link command. Not knowing how your make file is constructed I can't offer much more than that.

#151006 - coolalien - Sun Feb 17, 2008 12:08 am

ok that fixed that error but now it has a new one saying:

C:\devkitPro\examples\nds\Graphics\2D\hello_world>make
main.cpp
arm-eabi-g++ -MMD -MP -MF /c/devkitPro/examples/nds/Graphics/2D/hello_world/buil
d/main.d -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast
-math -mthumb -mthumb-interwork -I/c/devkitPro/examples/nds/Graphics/2D/hello_wo
rld/include -I/c/devkitPro/examples/nds/Graphics/2D/hello_world/build -IC:\devki
tPro\examples\nds\Graphics\2D\hello_world/libnds/include -IC:\devkitPro\examples
\nds\Graphics\2D\hello_world/libnds/include -I/c/devkitPro/examples/nds/Graphics
/2D/hello_world/build -DARM9 -fno-rtti -fno-exceptions -c /c/devkitPro/examples/
nds/Graphics/2D/hello_world/source/main.cpp -o main.o
linking hello_world.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/th
umb/ds_arm9_crt0.o: In function `CIDLoop':
ds_arm9_crt0.s:(.init+0x2ac): undefined reference to `initSystem'
main.o: In function `main':
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:48: undefined
reference to `irqInit'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:49: undefined
reference to `irqSet'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:50: undefined
reference to `irqEnable'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:53: undefined
reference to `vramSetBankC'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:60: undefined
reference to `consoleInitDefault'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:68: undefined
reference to `swiWaitForVBlank'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:69: undefined
reference to `touchReadXY'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/nds/Graphics/2D/hello_world/hello_world.elf]
Error 1
make: *** [build] Error 2

This error comes up while i am trying to make the first example while following a tutorial.

#151010 - Dwedit - Sun Feb 17, 2008 1:15 am

You should undo any changes you may have made to the source code or makefiles. When you have problems building the example programs, it means that there is something wrong with your build environment, not problems with the code. You should triple check that your environment variables are set correctly.

Also, you MUST build from the msys shell, cmd.exe is incompatible with those makefiles.

a successful build log looks something like this:
Code:

Dan Weiss@DANWEISS3 /c/devkitpro/examples/nds/Graphics/2D/hello_world
$ make
main.cpp
arm-eabi-g++ -MMD -MP -MF /c/devkitpro/examples/nds/Graphics/2D/hello_world/build/main.d -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/c/devkitpro/examples/nds/Graphics/2D/hello_world/include -I/c/devkitpro/examples/nds/Graphics/2D/hello_world/build -I/c/devkitPro/libnds/include -I/c/devkitPro/libnds/include -I/c/devkitpro/examples/nds/Graphics/2D/hello_world/build -DARM9 -fno-rtti -fno-exceptions -c /c/devkitpro/examples/nds/Graphics/2D/hello_world/source/main.cpp -o main.o
linking hello_world.elf
built ... hello_world.arm9
Nintendo DS rom tool 1.36 - Oct 22 2007 04:04:50
by Rafael Vuijk, Dave Murphy, Alexei Karpenko
built ... hello_world.nds

_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#151022 - tepples - Sun Feb 17, 2008 7:20 am

Dwedit wrote:
Also, you MUST build from the msys shell, cmd.exe is incompatible with those makefiles.

For some reason, the makefiles have always worked for me even in cmd.exe. I don't know why; all I can offer is a log of what happens on my system:
Code:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

E:\>C:

C:\>cd \devkitpro\examples\nds\templates\arm9

C:\devkitPro\examples\nds\templates\arm9>make clean
clean ...

C:\devkitPro\examples\nds\templates\arm9>make
main.c
arm-eabi-gcc -MMD -MP -MF /c/devkitPro/examples/nds/templates/arm9/build/main.d -g -Wall -O2 -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/c/devkitPro/examples/nds/templates/arm9/include -I/c/devkitPro/libnds/include -I/c/devkitPro/libnds/include -I/c/devkitPro/examples/nds/templates/arm9/build -DARM9 -c /c/devkitPro/examples/nds/templates/arm9/source/main.c -o main.o
linking arm9.elf
built ... arm9.arm9
Nintendo DS rom tool 1.36 - Oct 22 2007 04:04:50
by Rafael Vuijk, Dave Murphy, Alexei Karpenko
built ... arm9.nds

C:\devkitPro\examples\nds\templates\arm9>start arm9.nds

C:\devkitPro\examples\nds\templates\arm9>set | grep -i devkit
DEVKITARM=/c/devkitPro/devkitARM
DEVKITPRO=/c/devkitPro
Path=c:\devkitPro\msys\bin;C:\XP\system32;E:\bin;C:\XP;C:\XP\System32\Wbem;C:\Program Files\QuickTime\QTSystem\

C:\devkitPro\examples\nds\templates\arm9>

As far as I can tell, as long as MSYS is in the PATH and the DEVKITPRO variable is set correctly, the makefiles should work.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#151026 - coolalien - Sun Feb 17, 2008 11:05 am

I still get the same error in the msys shell.

Daniel@DANIEL-6C60013C /c/devkitpro/examples/nds/graphics/2d/hello_world
$ make
main.cpp
arm-eabi-g++ -MMD -MP -MF /c/devkitpro/examples/nds/graphics/2d/hello_world/buil
d/main.d -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast
-math -mthumb -mthumb-interwork -I/c/devkitpro/examples/nds/graphics/2d/hello_wo
rld/include -I/c/devkitpro/examples/nds/graphics/2d/hello_world/build -IC:\devki
tPro\examples\nds\Graphics\2D\hello_world/libnds/include -IC:\devkitPro\examples
\nds\Graphics\2D\hello_world/libnds/include -I/c/devkitpro/examples/nds/graphics
/2d/hello_world/build -DARM9 -fno-rtti -fno-exceptions -c /c/devkitpro/examples/
nds/graphics/2d/hello_world/source/main.cpp -o main.o
linking hello_world.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/th
umb/ds_arm9_crt0.o: In function `CIDLoop':
ds_arm9_crt0.s:(.init+0x2ac): undefined reference to `initSystem'
main.o: In function `main':
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:48: undefined
reference to `irqInit'
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:49: undefined
reference to `irqSet'
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:50: undefined
reference to `irqEnable'
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:53: undefined
reference to `vramSetBankC'
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:60: undefined
reference to `consoleInitDefault'
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:68: undefined
reference to `swiWaitForVBlank'
c:/devkitpro/examples/nds/graphics/2d/hello_world/source/main.cpp:69: undefined
reference to `touchReadXY'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitpro/examples/nds/graphics/2d/hello_world/hello_world.elf]
Error 1
make: *** [build] Error 2

could it be something to do with the parts i have underlined. Some have a slash before the C drive some don't. I tried looking for this but i couldn't find which file it is in.

#151027 - Cearn - Sun Feb 17, 2008 1:09 pm

The problem is at the link-stage, not the compilation stage. To see what actually goes on there, you'll have to make a small change to devkitARM/ds_rules. At the bottom you will find this:
Code:
%.elf:
   @echo linking $(notdir $@)
   @$(LD)  $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@

Change it to this:
Code:
%.elf:
   @echo linking $(notdir $@)
   $(LD)  $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@

Then build again, tell us what it says under "linking hello_world.elf".

(For good measure, you can also remove the double line in $(INCLUDE) from the example makefile:
Code:
export INCLUDE   :=   $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
               $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
               $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
               -I$(CURDIR)/$(BUILD)
 

to
Code:

export INCLUDE   :=   $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
               $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
               -I$(CURDIR)/$(BUILD)
)

#151028 - coolalien - Sun Feb 17, 2008 1:35 pm

it now says this:

arm-eabi-g++ -specs=ds_arm9.specs -g -mthumb -mthumb-interwork -mno-fpu -Wl,-Ma
p,hello_world.map main.o -LC:\devkitPro\examples\nds\Graphics\2D\hello_world/
libnds/lib -L/c/devkitpro/libnds/lib/lnds9 -o /c/devkitPro/examples/nds/Graphics
/2D/hello_world/hello_world.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/th
umb/ds_arm9_crt0.o: In function `CIDLoop':
ds_arm9_crt0.s:(.init+0x2ac): undefined reference to `initSystem'
main.o: In function `main':
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:48: undefined
reference to `irqInit'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:49: undefined
reference to `irqSet'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:50: undefined
reference to `irqEnable'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:53: undefined
reference to `vramSetBankC'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:60: undefined
reference to `consoleInitDefault'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:68: undefined
reference to `swiWaitForVBlank'
c:/devkitPro/examples/nds/Graphics/2D/hello_world/source/main.cpp:69: undefined
reference to `touchReadXY'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/nds/Graphics/2D/hello_world/hello_world.elf]
Error 1
make: *** [build] Error 2

#151039 - Cearn - Sun Feb 17, 2008 4:57 pm

coolalien wrote:
it now says this:

arm-eabi-g++ -specs=ds_arm9.specs -g -mthumb -mthumb-interwork -mno-fpu -Wl,-Ma
p,hello_world.map main.o -LC:\devkitPro\examples\nds\Graphics\2D\hello_world/
libnds/lib -L/c/devkitpro/libnds/lib/lnds9
-o /c/devkitPro/examples/nds/Graphics
/2D/hello_world/hello_world.elf
The bolded parts are not what they're supposed to be. There are two variables controlling which libraries are used and where they are found: LIBS and LIBDIRS.

LIBS lists the names of the libraries ... kinda. The pattern -lname (lowercase 'l') means as much as "use the library named "libname.a". "-lnds9" tells the linker to look for "libnds9.a".

LIBDIRS is where the linker will search for them ... kinda. They're actually the directories the library is in without the "/lib" directory part at the end. If the library is "foo/lib/libbar.a", LIBDIRS should only have the "foo" part Note: no -L here; that and the "/lib" part are added by LIBPATHS later. ds_rules already has a variable to use here: LIBNDS.

The lines should then look like this:
Code:
LIBS   := -lnds9

LIBDIRS   :=   $(LIBNDS)

My guess is that right now they look more like this:
Code:
LIBS   := -L/c/devkitpro/libnds/lib/lnds9

LIBDIRS   :=   C:\devkitPro\examples\nds\Graphics\2D\hello_world/
libnds/


coolalien wrote:
Some have a slash before the C drive some don't. I tried looking for this but i couldn't find which file it is in.
This is actually the standard notation for directories under POSIX. /c/foo/bar is equivalent to c:\foo\bar. That you have something with C:\ and backward slashes be actually be part of the problem.

#151053 - coolalien - Sun Feb 17, 2008 7:51 pm

it now just has this one error:

arm-eabi-g++ -specs=ds_arm9.specs -g -mthumb -mthumb-interwork -mno-fpu -Wl,-Ma
p,hello_world.map main.o -lnds9 -o /c/devkitPro/examples/nds/Graphics/2D/hel
lo_world/hello_world.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/bin/ld
.exe: cannot find -lnds9
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/nds/Graphics/2D/hello_world/hello_world.elf]
Error 1
make: *** [build] Error 2

it says it can't find the file but it is there and i have put the right path to get to it.

#151079 - Cearn - Mon Feb 18, 2008 3:13 pm

coolalien wrote:
it now just has this one error:

arm-eabi-g++ -specs=ds_arm9.specs -g -mthumb -mthumb-interwork -mno-fpu -Wl,-Ma
p,hello_world.map main.o -lnds9 -o /c/devkitPro/examples/nds/Graphics/2D/hello_world/hello_world.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/bin/ld
.exe: cannot find -lnds9
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/nds/Graphics/2D/hello_world/hello_world.elf]
Error 1
make: *** [build] Error 2

it says it can't find the file but it is there and i have put the right path to get to it.

The path information should have been present between main.o and -lnds. If you added it, the rest of the makefile didn't pick up on it somehow.

You could try to find out exactly what's going wrong by adding debug echo statements for some of the variables to see what's happening (in particular $(LIBDIRS) and $(LIBPATHS)). Or you could paste the whole makefile here and let us figure it .

#151084 - coolalien - Mon Feb 18, 2008 5:40 pm

this is the make file:

#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif

include /C/devkitpro/devkitARM/ds_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := gfx source data
INCLUDES := include build

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork

# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
# *insists* it has a FPU or VFP, and it won't take no for an answer!
CFLAGS := -g -Wall -O2\
-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lnds9


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES := $(BINFILES:.bin=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds : $(OUTPUT).arm9
$(OUTPUT).arm9 : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)

#---------------------------------------------------------------------------------
%.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)


-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

#151085 - Cearn - Mon Feb 18, 2008 6:47 pm

Works fine for me O_o.

The only way I can get the exact error you get is it comment out the LIBNDS variable in ds_rules after I got a working compilation. Normally, a non-existing LIBNDS would stop the compilation as well (which was your original problem), but since you got that part to work somehow the makefile will only try linking.

Looking at the earlier errors, there's no reference to LIBNDS there either, yet it still works. There is a "-IC:\devkitPro\examples\nds\Graphics\2D\hello_world/libnds/include" ... did you add the whole libnds directory to the hello_world folder?

I also notice that the at the top it said "include /c/devkitpro/devkitARM/ds_rules" instead of the usual "include $(DEVKITARM)/ds_rules", why did you change this?

#151088 - coolalien - Mon Feb 18, 2008 7:34 pm

i changed the
Quote:
include /c/devkitpro/devkitARM/ds_rules
because someone on another website said to do this but changing it back to what it should be doesn't solve he error..
i haven't added the whole libnds directory to the hello_world folder.

#151090 - silent_code - Mon Feb 18, 2008 8:22 pm

hey, DID YOU CHECK YOUR ENVIRONMENT VARIABLES (MSYS AND DEVKIT)??? some other guys asked for that, but you don't seem to have responded to it, yet!

PLEASE CHECK YOUR ENVIRONMENT VARIABLES!

#151092 - coolalien - Mon Feb 18, 2008 8:50 pm

i've checked the environment variables and they are correct

#151094 - coolalien - Mon Feb 18, 2008 8:58 pm

its ok i have got it working now. One of the environment variables was C:\ while the other was /c/.