How do I check OS with a preprocessor directive?

前端 未结 16 1527
星月不相逢
星月不相逢 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:09

    In most cases it is better to check whether a given functionality is present or not. For example: if the function pipe() exists or not.

提交回复
热议问题