Jump to content
  • Advertisement
Sign in to follow this  
Preacher

Detecting Platform C++

This topic is 4886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi just looking through some source code and noticing that C++ uses defines to check what platform its running on eg WIN32, OSX. Ive seen the mac defined as MACOS and OSX and wondered is there any list i can llok up of standard defines for all systems or is it compiler dependant?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Preacher
Hi just looking through some source code and noticing that C++ uses defines to check what platform its running on eg WIN32, OSX. Ive seen the mac defined as MACOS and OSX and wondered is there any list i can llok up of standard defines for all systems or is it compiler dependant?


What you're detecting isn't really the platform the compiler is running on... but the target platform the code is being compiled for.

I believe there's __LINUX__ and _MAC as well as _WIN32 & _WIN64. Surely Solaris, BeOS, etc. have theirs, too.

Share this post


Link to post
Share on other sites
None of those defines are standard, but it all works out pretty good.

Have a look at boost.org, they have a section of code that detects everything, the compiler, the platform, & even the STL library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!