DevKitPro Help!

Discussion in 'NDS - Emulation and Homebrew' started by Xexyz, Oct 4, 2013.

  1. Xexyz
    OP

    Xexyz GBATemp's™ Official Xexyz

    Member
    1,393
    470
    Jul 29, 2013
    United States
    沖縄県
    Hello, I was trying to compile code on Devkitpro for nds but I always get this error.

    Code:
    > "make"
    "make": *** No targets specified and no makefile found.  Stop.
     
    > Process Exit Code: 2
    > Time Taken: 00:01
    


    The code is.



    Code:
    /*---------------------------------------------------------------------------------
     
        $Id: main.cpp,v 1.13 2008-12-02 20:21:20 dovoto Exp $
     
        Simple console print demo
        -- dovoto
     
     
    ---------------------------------------------------------------------------------*/
    #include <nds.h>
     
    #include <stdio.h>
     
    volatile int frame = 0;
     
    //---------------------------------------------------------------------------------
    void Vblank() {
    //---------------------------------------------------------------------------------
        frame++;
    }
       
    //---------------------------------------------------------------------------------
    int main(void) {
    //---------------------------------------------------------------------------------
        touchPosition touchXY;
     
        irqSet(IRQ_VBLANK, Vblank);
     
        consoleDemoInit();
     
        iprintf("      Hello DS dev'rs\n");
        iprintf("    \x1b[32mwww.devkitpro.org\n");
        iprintf("  \x1b[32;1mwww.drunkencoders.com\x1b[39m");
     
        while(1) {
       
            swiWaitForVBlank();
            touchRead(&touchXY);
     
            // print at using ansi escape sequence \x1b[line;columnH
            iprintf("\x1b[10;0HFrame = %d",frame);
            iprintf("\x1b[16;0HTouch x = %04X, %04X\n", touchXY.rawx, touchXY.px);
            iprintf("Touch y = %04X, %04X\n", touchXY.rawy, touchXY.py);       
       
        }
     
        return 0;
    }
    
    How do I fix this?
     
  2. ipwndeveloper

    ipwndeveloper GBAtemp Regular

    Member
    276
    68
    Jun 3, 2013
    United States
    San Fransisco, CA
    You need a makefile, so create a new text document in notepad named "Makefile" (no extention)
    and paste this in:
    Code:
    #---------------------------------------------------------------------------------
    .SUFFIXES:
    #---------------------------------------------------------------------------------
     
    ifeq ($(strip $(DEVKITARM)),)
    $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
    endif
     
    include $(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
    # DATA is a list of directories containing binary files embedded using bin2o
    # GRAPHICS is a list of directories containing image files to be converted with grit
    # ICON is the image used to create the game icon, leave blank to use default rule
    #---------------------------------------------------------------------------------
    TARGET        :=    $(shell basename $(CURDIR))
    BUILD        :=    build
    SOURCES        :=    source
    INCLUDES    :=    include
    DATA        :=    data 
    GRAPHICS    :=    gfx 
    ICON        :=
     
    # specify a directory which contains the nitro filesystem
    # this is relative to the Makefile
    NITRO_FILES    :=
     
    # These set the information text in the nds file
    GAME_TITLE        :=    NDSHomebrew
    GAME_SUBTITLE1    :=    title2
    GAME_SUBTITLE2    :=    title3
     
    #---------------------------------------------------------------------------------
    # options for code generation
    #---------------------------------------------------------------------------------
    ARCH    :=    -mthumb -mthumb-interwork -march=armv5te -mtune=arm946e-s
     
    CFLAGS    :=    -g -Wall -O2\
            -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) -Wl,-Map,$(notdir $*.map)
     
    #---------------------------------------------------------------------------------
    # any extra libraries we wish to link with the project (order is important)
    #---------------------------------------------------------------------------------
    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    :=    $(CURDIR)/$(subst /,,$(dir $(ICON))) \
                        $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
                        $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
                        $(foreach dir,$(GRAPHICS),$(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)))
    PNGFILES    :=    $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
    BINFILES    :=    $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
     
    #---------------------------------------------------------------------------------
    # use CXX for linking C++ projects, CC for standard C
    #---------------------------------------------------------------------------------
    ifeq ($(strip $(CPPFILES)),)
    #---------------------------------------------------------------------------------
        export LD    :=    $(CC)
    #---------------------------------------------------------------------------------
    else
    #---------------------------------------------------------------------------------
        export LD    :=    $(CXX)
    #---------------------------------------------------------------------------------
    endif
    #---------------------------------------------------------------------------------
     
    export OFILES    :=    $(addsuffix .o,$(BINFILES)) \
                        $(PNGFILES:.png=.o) \
                        $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
     
    export INCLUDE    :=    $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
                        $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
                        -I$(CURDIR)/$(BUILD)
     
    export LIBPATHS    :=    $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
     
    ifeq ($(strip $(ICON)),)
        icons := $(wildcard *.bmp)
       
        ifneq (,$(findstring $(TARGET).bmp,$(icons)))
            export GAME_ICON := $(CURDIR)/$(TARGET).bmp
        else
            ifneq (,$(findstring icon.bmp,$(icons)))
                export GAME_ICON := $(CURDIR)/icon.bmp
            endif
        endif
    else
        ifeq ($(suffix $(ICON)), .grf)
            export GAME_ICON := $(CURDIR)/$(ICON)
        else
            export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
        endif
    endif
     
    .PHONY: $(BUILD) clean
     
    #---------------------------------------------------------------------------------
    $(BUILD):
        @[ -d $@ ] || mkdir -p $@
        [USER=37900]make[/USER] --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
     
    #---------------------------------------------------------------------------------
    clean:
        [USER=325063]Echo[/USER] clean ...
        @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
     
    #---------------------------------------------------------------------------------
    else
     
    #---------------------------------------------------------------------------------
    # main targets
    #---------------------------------------------------------------------------------
    $(OUTPUT).nds    :    $(OUTPUT).elf $(GAME_ICON)
    $(OUTPUT).elf    :    $(OFILES)
     
    #---------------------------------------------------------------------------------
    %.bin.o    :    %.bin
    #---------------------------------------------------------------------------------
        [USER=325063]Echo[/USER] $(notdir $<)
        $(bin2o)
     
    #---------------------------------------------------------------------------------
    # This rule creates assembly source files using grit
    # grit takes an image file and a .grit describing how the file is to be processed
    # add additional rules like this for each image extension
    # you use in the graphics folders
    #---------------------------------------------------------------------------------
    %.s %.h  : %.png %.grit
    #---------------------------------------------------------------------------------
        grit $< -fts -o$*
     
    #---------------------------------------------------------------------------------
    # Convert non-GRF game icon to GRF if needed
    #---------------------------------------------------------------------------------
    $(GAME_ICON): $(notdir $(ICON))
    #---------------------------------------------------------------------------------
        [USER=325063]Echo[/USER] convert $(notdir $<)
        @grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
     
    -include $(DEPSDIR)/*.d
     
    #---------------------------------------------------------------------------------------
    endif
    #---------------------------------------------------------------------------------------
    
    If it fails to build, then there could be something wrong with your compiler, check that you have the latest versions and all the dependencies needed, PAlib (ugh), LIBNDS, Nightfoxlib, and any other libraries needed to compile.
    Good Luck!
     
  3. Duo8

    Duo8 I don't like video games

    Member
    3,444
    1,144
    Jul 16, 2013
    I also have build problems
    Log:
    Code:
    Command Lines      Creating temporary file "C:\Users\Admin\AppData\Local\Temp\BAT00000154004352.bat" with contents
    [
    [USER=325063]Echo[/USER] off
     
    make -r 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/
     
    if errorlevel 1 goto VCReportError
     
    goto VCEnd
     
    :VCReportError
     
    echo Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
     
    exit 1
     
    :VCEnd
    ]
    Creating command line "C:\Users\Admin\AppData\Local\Temp\BAT00000154004352.bat"
    Output Window      Performing Makefile project actions
    Project : error PRJ0002 : Error result 255 returned from 'C:\Windows\SysWow64\cmd.exe'.
    Results      Build log was saved at "file://d:\dsdev\NintendoDS1\NintendoDS1\Debug\BuildLog.htm"
    NintendoDS1 - 1 error(s), 0 warning(s)
    
    Code:
    1>------ Build started: Project: NintendoDS1, Configuration: Debug Win32 ------
    1>Performing Makefile project actions
    1>Project : error PRJ0002 : Error result 255 returned from 'C:\Windows\SysWow64\cmd.exe'.
    1>Build log was saved at "file://d:\dsdev\NintendoDS1\NintendoDS1\Debug\BuildLog.htm"
    1>NintendoDS1 - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    
     
  4. Xexyz
    OP

    Xexyz GBATemp's™ Official Xexyz

    Member
    1,393
    470
    Jul 29, 2013
    United States
    沖縄県
    Same error. :(
     
  5. ipwndeveloper

    ipwndeveloper GBAtemp Regular

    Member
    276
    68
    Jun 3, 2013
    United States
    San Fransisco, CA
    I compiled from your source using my makefile, and it worked just fine, just tested in desmume. I am going to
    I am actually compiling on OSX using a jury-rigged portions of the windows, and osx versions as not all libraries were ported to OSX, thankfully libnds was ported to osx.
    here is the whole compiled directory: http://cl.ly/0o3P3d0c2N35 good luck, I will check back tomorrow
     
  6. Xexyz
    OP

    Xexyz GBATemp's™ Official Xexyz

    Member
    1,393
    470
    Jul 29, 2013
    United States
    沖縄県
    New error if put makefile in the folder with the project file.

    Captiuiuiuiure.PNG
     
  7. ipwndeveloper

    ipwndeveloper GBAtemp Regular

    Member
    276
    68
    Jun 3, 2013
    United States
    San Fransisco, CA
    well turns out I have some extra time!, so for this error I would do a clean install of the latest devkit pro. It looks like you are using the examples. Did you ad any PAlib specific code ( I am not against it its just that it breaks devkitARM). try cd'ing into this directory (its a different one with a slightly different source) and trying to compile or 'make' this project to determine if the compiler is messed up, it looks like based on the screennshot that you may need to reinstall as something is missing.
    This is what a normal-ish compiler will output:
    Code:
    matthew$ make
    main.c
    arm-none-eabi-gcc -MMD -MP -MF /Users/devaccount/Desktop/source/build/main.d -g -Wall -O2 -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -march=armv5te -mtune=arm946e-s -iquote /Users/devaccount/Desktop/source/include -I/opt/devkitpro/libnds/include -I/Users/devaccount/Desktop/source/build -DARM9 -c /Users/devaccount/Desktop/source/source/main.c -o main.o
    linking source.elf
    Nintendo DS rom tool 1.50.1 - Jun 18 2012
    by Rafael Vuijk, Dave Murphy, Alexei Karpenko
    built ... source.nds
     
     
    
    verrified to build code, based on your main.ccp from the first post, except for that I transplanted it into the "main.c" source under the directory "source"