Setting Up #ifdef In Visual Studio


p0is0n

Still Fresh
Hi guys,

I'm trying to set up my Visual Studio project so that it works for the GP2X and Win32, I have the projects set up properly, but cant figure out how to set it up so that i can wrap platform specific code in #ifdefs like this:

#ifdef _GP2X
printf("Exiting back to the main menu");
chdir("/usr/gp2x");
execl("/user/gp2x/gp2xmenu", "/user/gp2x/gp2xmenu", NULL);
#endif

Any help on this would be appreciated, as the code inside my #ifdef is never getting executed.
 
The last version of VS I used was 6.0, so this might not apply for more recent versions. Go to the project settings and click the C/C++ tab, then choose "Pre-processor" in the category dropdown. Add _GP2X to the definitions when you're compiling for the 2X - they're comma separated.
 
theres also an alternative way by using a shell script. The plus is if your app crashes the menu can still be loaded.
 
Back
Top