Author Topic: Cross Platform with Code::Blocks  (Read 5769 times)

Offline shadowayex

  • Single posting newcomer
  • *
  • Posts: 3
Cross Platform with Code::Blocks
« 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.

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Cross Platform with Code::Blocks
« Reply #1 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

Offline shadowayex

  • Single posting newcomer
  • *
  • Posts: 3
Re: Cross Platform with Code::Blocks
« Reply #2 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.

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Cross Platform with Code::Blocks
« Reply #3 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