VC2008,如何关闭 C++/CLI 项目中单个文件的 CLR 标志
这篇文章说可以关闭单个 .cpp 文件的 CLR 标志。
来自帖子: 您可以在每个 .cpp 文件中单独设置 /CLR 打开或关闭。 打开它用于 整个项目,. 正如您所做的那样,然后关闭文件 仅包含本机(非托管)代码。 当你有VC++项目时 属性对话框打开,您仍然可以单击文件/项目 解决方案资源管理器来更改您正在处理的范围。 单击 非托管 .cpp 文件来设置该文件的选项。
这是真的吗? 我不知道如何通过我的 C++/CLI 项目的属性页来完成此操作。 我将如何实现这个目标?
This post says that it is possible to turn off the CLR flag for an individual .cpp file.
From the post:
You can set /CLR on or off in each .cpp file individually. Turn it on for
the whole project,. as you have done, then turn it off for the files
containing only native (unmanaged) code. When you have the VC++ procject
properties dialog open, you can still click on files/projects in the
solution explorer to change the scope that you're working on. Click on the
unmanaged .cpp file to set options for just that file.
Is this true? I can't figure out how to do it through the property pages for my C++/CLI project. How would I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需右键单击“解决方案资源管理器”中的文件并单击“属性”即可。 该选项是“使用公共语言运行时支持进行编译”,位于 C/C++ -> 下。 一般的。
Just right click on a file in Solution Explorer and hit Properties. The option is "Compile with Common Language Runtime Support", under C/C++ -> General.
需要注意的一件事是预编译头。 但是,您可以在混合项目中重新启用预编译头文件。 如果添加诸如 stdafx.mgd.cpp / stdafx.mgd.h 之类的内容,然后,对于为 C++/CLI 配置的每个文件,将“通过文件使用 PCH”更改为 stdafx.mgd.h 并附加“.mgd” .pch”位于下面预编译头文件行的末尾...(必须与您用于 stdafx.mgd.cpp 的命名相匹配并选择“创建预编译头...”)
如此习惯于加快 C# 编译时间,每一点都有助于提高 C++/CLI 编译的性能...哦,别忘了 /MP ;)
抱歉,这有点偏离主题,但它通常是相关的/后续步骤...
One thing to look out for is also precompiled headers. However, you can re-enable precompiled header files in a mixed project. If you add something like stdafx.mgd.cpp / stdafx.mgd.h, and then, for each file you configure for C++/CLI, change the "Use PCH through file" to your stdafx.mgd.h and append ".mgd.pch" at the end of the precompiled header file line below... (which must match your naming you used for the stdafx.mgd.cpp and selected "Create precompiled headers...")
Being so use to speedy C# compilation times, every little bit helps improve perf on the C++/CLI compiles... oh ya, dont forget /MP ;)
Sorry it's a bit off topic, but it's usually related/next-steps...
没关系,答案就在我面前(即使在我引用的段落中)。
您仍然可以单击
解决方案资源管理器来更改您正在处理的范围。 单击
非托管 .cpp 文件来为该文件设置选项。
这只是那些日子之一:-)
Nevermind, the answer was right in front of me (even in the paragraph I quoted).
you can still click on files/projects in the
solution explorer to change the scope that you're working on. Click on the
unmanaged .cpp file to set options for just that file.
It's just one of those days :-)
右键单击“解决方案资源管理器”上的文件名 > 属性> C/C++。
Right click on filename on Solution Explorer > Properties > C/C++.