Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: shadowayex on August 28, 2010, 02:21:05 am

Title: Cross Platform with Code::Blocks
Post by: shadowayex on August 28, 2010, 02:21:05 am
I want to use Code::Blocks to compile cross-platform code, but I need to use the C++ preprocessor at times to swap between platform specific code.

One case is I need to detect when I'm in Windows and when I'm in *nix based systems. I always install Code::Blocks with the compiler that comes with it, so I need to know what macros are defined to detect when I'm in the Windows version or in the *nix version. I can't find the macros by Googling, so I thought I'd ask here.
Title: Re: Cross Platform with Code::Blocks
Post by: kencamargo on August 28, 2010, 04:29:16 am
I can't find the macros by Googling, so I thought I'd ask here.

I guess you are not up to date with your google fares. :) Have you tried, for instance, http://predef.sourceforge.net/preos.html?

This is not a codeblocks issue, though, and this topic stands a great chance of being locked. Please check forum guidelines.

Ken
Title: Re: Cross Platform with Code::Blocks
Post by: shadowayex on August 28, 2010, 06:30:56 pm
I thought they were different going from one place to another, I figured I'd see what Code::Blocks were.

Thanks for the list though, That should cover everything, I hope.
Title: Re: Cross Platform with Code::Blocks
Post by: kencamargo on August 28, 2010, 10:46:13 pm
I thought they were different going from one place to another, I figured I'd see what Code::Blocks were.

As you'll see it often repeated if you just hang around enough, codeblocks is "just" an IDE. It works with dozens of compilers on almost as many OSs. Predefined macros are compiler-specific, and the IDE does not, and does not have to, know anything about them.

Quote
Thanks for the list though, That should cover everything, I hope.

You're welcome, but better abide by forum rules...

Ken