xboxscene.org forums

Author Topic: Openxdk And Visual Studio 2005/2008  (Read 300 times)

halofreak1990

  • Archived User
  • Newbie
  • *
  • Posts: 46
Openxdk And Visual Studio 2005/2008
« on: October 06, 2010, 02:41:00 PM »

I know it's been tried before without much success to compile OpenXDK apps with VS2005.
I am a great fan of Visual Studio and its IntelliSense, and I was getting annoyed with scrolling up and down my source files to track down errors, while any program working in VS would report its compile errors and allow you to get to the faulty code with a simple double-click.

So I went searching for an answer and came up with this:
use Cygwin to compile and VS to manage the source code.

What you need is the Cygwin install recommended by OpenXDK, plus a program called 'sed', which can be found under the category 'Base' in the cygwin installer.

Once you've got Cygwin and OpenXDK working, and sed installed, open up Visual Studio and create a 'Makefile Project'
Open the properties, and go to NMake
In the 'Build Command Line' field you need to put this: make -f makefile all 2>&1 | sed -e 's/\(\w\+\):\([0-9]\+\):/\1(\2):/' where makefile is, obviously, your makefile, and 'all' is the configuration you want to build.
What this line does, is to call make, and pipe its output to sed, which then formats it in such a way VS will interpret it as if it came from msbuild. The only thing it doesn't seem to catch, are the 'no such file, or directory' errors, but if you want to see those, just go to View>Output, and take a look.

You can do the same for the 'Clean Command Line' to have VS be able to do both build, and clean:
make -f makefile clean 2>&1 | sed -e 's/\(\w\+\):\([0-9]\+\):/\1(\2):/' notice how I've replaced 'all' by 'clean'.

Now, in order to get IntelliSense to work, you need to add the paths to the OpenXDK headers to the 'Include Search Path' field, separated by ;
Also, if you want, you can define some Prepocessor definitions, but they won't be passed to make, so you should make sure that any preprocessor definitions here, are also present in your makefile.

Now, click apply, and edit away. The only non-trivial task beyond this is that you manually need to add each source file to the makefile.

This should also work in VS2008.
Logged