使用标准 #ifndef MS-VC++ 覆盖 #pragma 一次
我还没有看到这个问题的任何答案(这可能意味着这是不允许的),但我想我还是会问。
有什么方法可以覆盖使用 MS Visual-C++ 创建的 .h
或 .hpp
文件中自动生成的 #pragma Once
来使用使用便携式友好预处理器指令的标准标头防护?
#ifndef _V_DESCRIPTOR_
#define _V_DESCRIPTOR_
// some code here
#endif
I haven't seen any answers to this question (which probably means that it's not allowed) but I thought I'd ask anyway.
Is there any way to override the automatic generation of #pragma once
in .h
or .hpp
files created using MS Visual-C++ to use the standard header guards of using portable friendly preprocessor directives?
#ifndef _V_DESCRIPTOR_
#define _V_DESCRIPTOR_
// some code here
#endif
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了回答您真正的问题,我认为 Visual Studio 没有任何选项,但使用 Visual Studio Extensibility Toolkit 可以非常简单,因此我确信有人已经编写了一个您可以下载的宏。环视工具->扩展管理器->在线图库,有大量免费插件可供您安装。
例如,出现 Zoom C++ 类向导生成两种样式的包含防护。但我从未使用过它,所以我无法以某种方式提出建议。
To answer your real question, I don't think Visual Studio has any option for that, but it would be pretty simple to do with the Visual Studio Extensibility Toolkit, so I'm sure someone has written a macro you can download. Look around Tools -> Extension Manager -> Online Gallery, there's a large catalog of free addins you can install.
For example, the Zoom C++ Class Wizard appears to generate both styles of include guard. But I've never used it so I can't make a recommendation one way or the other.