Check if bool is defined in mixed C/C++

前端 未结 4 1007
甜味超标
甜味超标 2021-02-05 19:51

So I\'m having issues with some code that I\'ve inherited. This code was building fine in a C-only environment, but now I need to use C++ to call this code. The header p

4条回答
  •  感动是毒
    2021-02-05 20:54

    You should use the __cplusplus macro:

    #ifndef __cplusplus
    #ifndef _BOOL
    typedef unsigned char bool;
    static const bool False = 0;
    static const bool True = 1;
    #endif
    #endif 
    

    Check out this link to the C++ FAQ for further details.

提交回复
热议问题