添加我自己的编译器警告 [英] Add my own compiler warning

查看:41
本文介绍了添加我自己的编译器警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用sprintf时,编译器会警告我该函数已弃用.

When using sprintf, the compiler warns me that the function is deprecated.

如何显示我自己的编译器警告?

How can I show my own compiler warning?

推荐答案

Visual Studio 中,

#pragma消息(警告在这里")

另一方面,如果您想抑制这样的警告,找到编译器警告ID(对于不赞成使用的警告,其为 C4996 )并插入以下行:

On a side note, if you want to suppress such warnings, find the compiler warning ID (for the deprecated warning, it's C4996) and insert this line:

#pragma警告(禁用:4996 )

这篇关于添加我自己的编译器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆