Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

shaobohou

how to detect when compiling on win32

This topic is 5241 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

This is something I thought I did correctly I have a function that requires different to be compile depends on whether you are in windows or in linux, so: #ifdef WIN32 #include <windows.h> windows code #else linux code #endif this is used to work, I took the code into a different program and try to compile it with dev-cpp, it seems not longer able to differentiate when it is in windows thus causing compiler error. What is the standard way for detecting if you compiling on windows ?

Share this post


Link to post
Share on other sites
Advertisement
#ifdef WIN32 is the way to detect it. Microsoft decreed it is so.

If dev-cpp doesn''t define this symbol, you have to provide it on the command line using -DWIN32

Share this post


Link to post
Share on other sites
you may also try

#ifdef _WIN32

WIN32 usually works on MinGW, perhaps dev-cpp is passing some flags that undefine it.

Aeon Games

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!