How do I check OS with a preprocessor directive?

前端 未结 16 1342
星月不相逢
星月不相逢 2020-11-22 13:53

I need my code to do different things based on the operating system on which it gets compiled. I\'m looking for something like this:

#ifdef OSisWindows
// do         


        
16条回答
  •  囚心锁ツ
    2020-11-22 14:15

    Sorry for the external reference, but I think it is suited to your question:

    C/C++ tip: How to detect the operating system type using compiler predefined macros

提交回复
热议问题