News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Cross Platform with Code::Blocks

Started by shadowayex, August 28, 2010, 02:21:05 AM

Previous topic - Next topic

shadowayex

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.

kencamargo

Quote from: shadowayex on August 28, 2010, 02:21:05 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

shadowayex

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.

kencamargo

Quote from: 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.

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