Where is WIN32 defined, and how can I include this definition in my project?

后端 未结 6 1001
逝去的感伤
逝去的感伤 2021-01-11 21:06

I am including a third party header and source file into my project.

At the top of the header there is this:

#if defined(WIN32) || defined(WIN16)
#i         


        
6条回答
  •  醉梦人生
    2021-01-11 21:26

    You can simply include the windows header files (windows.h) before including the third party header - as you already found out WIN32 is defined there but technicaly it could be defined anywhere (so if the third party project is not including the windows headers check if it's being defined in the compiler project settins directly).

    BTW there is also a _WIN32 define that is set by the compiler, it's possibly a better idea to look for this define if checking if the code is being compiled under windows;

提交回复
热议问题