Setup SGDK with Eclipse (old)

Stephane Dallongeville edited this page Mar 17, 2015 · 1 revision

Here's how to use the devkit with Eclipse CDT IDE

Setup your files

Download Eclipse CDT at http://www.eclipse.org/cdt/downloads.php

  • Create a directory for Genesis development only, without space or special chars
  • Unzip EclipseCDT and SGDK there
  • Rename SGDK's one as "sdk"
  • Create an other directory called "projects".

In the end, you have

<parent folder>
	->eclipse folder
	->sdk folder
	->projects folder

Don't forget to add SGDK's bin folder in your Windows PATH

For XP, see tutorial at http://roy.vanegas.org/teaching/c/modifying_windows_path_for_gcc.html

For 7, open control panel > system, select advanded system parameters and jump to step 4 of above tutorial

Setup Eclipse

IMPORTANT : Be sure to use slash "/" to define any folder else make will fail

Launch Eclipse and select /projects as workspace folder

 each new project will be added to this folder by Eclipse 

Go to the workbench and select menu Window > Preferences to setup Eclipse

In General > Workspace, select Save automatically before build and unselect Build automatically

In C/C++ > Build > Build Variables, add a new variable :

  • Variable name : GDK
  • Type : Directory
  • Value : (browse to /sdk)
 this will define $GDK needed by sdk/makefile.gen

http://sgdk.googlecode.com/svn/wiki/pictures/eclipse01.jpg

In C/C++ > Build > Environnement, add a new variable

  • Name : GDK
  • Value : (full path to /sdk)
 this will define a var used on Eclipse IDE

http://sgdk.googlecode.com/svn/wiki/pictures/eclipse02.jpg

In C/C++ > New CDT Project Wizard > Makefile Project

  • unselect Use default build command in Builder Settings tab
  • set, as Build command, ${GDK}\bin\make -f ${GDK}/makefile.gen
 this will define  sdk/makefile.gen as the default makefile of any project

http://sgdk.googlecode.com/svn/wiki/pictures/eclipse03.jpg

Setup Project

You could now create a new project (File > New > C Project).

Right-click on it and select Properties to setup the project itself.

In C/C++ General > Paths and Symbols, add a new directory in Includes tab

  • Directory : ${GDK}/include
  • Add to all configurations
  • Add to all languages

http://sgdk.googlecode.com/svn/wiki/pictures/eclipse05.jpg

Click Apply and rebuild the index

http://sgdk.googlecode.com/svn/wiki/pictures/eclipse06.jpg

this will make available the headers on <parent folder>/sdk/include to your project

On Make Target view, create a new target for your project.

  • give it a name
  • unselect Same as the target name
  • empty Make target field http://sgdk.googlecode.com/svn/wiki/pictures/eclipse07.jpg
 double click on this target to generate a out/rom.bin according your project's file, sdk/makefile.gen and sgdk library

Setup Gens

If you want to launch the rom on Gens from Eclipse

  • Right click on the generated out/rom.bin.
  • Select Open With > Others...
  • Browse for gens.exe on External programs tab http://sgdk.googlecode.com/svn/wiki/pictures/eclipse08.jpg

Common error

If you have an error on build like main() not found, be sure to click Apply on project properties's C/C++ General > Paths and Symbols.

Another source of problem : be sure to un-mark Project>Build automatically

And be sure to use slash "/" !!