How to WRITE compile time warning for user

后端 未结 1 1042
情歌与酒
情歌与酒 2021-01-18 05:53

I would like to write a Pragma warning in GNU G++ for every user that compile my codes.

How can i do this? I am using GNU G++ compiler.

1条回答
  •  时光说笑
    2021-01-18 06:27

    MSVC and newer GCCs support:

    #pragma message ( "your warning text here" )
    

    In GCC the other syntax is also commonly used:

    #warning "you warning text here"
    

    See also question: Portability of #warning preprocessor directive and GCC documentation

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