Visual C++:如何在代码中嵌入和显示编译时消息?

发布于 2024-07-24 06:22:10 字数 191 浏览 1 评论 0原文

有没有办法在编译该代码段时编译时期间显示的代码中嵌入消息? 这些消息本质上是诊断性的,不应修改或中止编译过程。

(免责声明:我知道这个问题的答案。我没有在 Stack Overflow 上找到它,我认为这对这里的知识库来说是一个有用的补充。)

Is there a way to embed a message in code that is displayed during compile-time when that piece of code is being compiled? The messages are diagnostic in nature and should not modify or abort the compile process.

(Disclaimer: I know the answer to this question. I didn't find it asked on Stack Overflow and I think it would be an useful addition to the knowledge base here.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜无邪 2024-07-31 06:22:10

这是一种方法:

#pragma message("Your Message Here")

https://msdn.microsoft.com/en -us/library/x7dkzch2.aspx

This is one way to do it:

#pragma message("Your Message Here")

https://msdn.microsoft.com/en-us/library/x7dkzch2.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文