Create custom #warning flags

后端 未结 2 1805
故里飘歌
故里飘歌 2020-12-20 22:30

I\'m building a commercial app, and we are using some GPL code to help us along.

How can I add #warning or #error statements so that when t

相关标签:
2条回答
  • 2020-12-20 23:01

    Use #pragma message instead.

    0 讨论(0)
  • 2020-12-20 23:02
    #ifdef SOME_SYMBOL
    #error "foobar"
    #else
    #warning "foobar"
    #endif
    

    NDEBUG has a slightly different purpose (controlling assert) and may be #undef and re-defined selectively (reincluding assert.h to effect the change), so it probably wouldn't be the right symbol. But it is a standard macro and could be used.

    Note that #error is standard, but #warning is an extension.

    0 讨论(0)
提交回复
热议问题