This post says that it is possible to turn off the CLR flag for an individual .cpp file.
这篇文章说可以关闭单个.cpp文件的CLR标志。
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.
从帖子:您可以单独在每个.cpp文件中打开或关闭/ CLR。为整个项目打开它。如您所做,然后关闭仅包含本机(非托管)代码的文件。当您打开VC ++ procject属性对话框时,仍然可以单击解决方案资源管理器中的文件/项目来更改您正在处理的范围。单击非托管.cpp文件以仅为该文件设置选项。
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?
这是真的?我无法弄清楚如何通过我的C ++ / CLI项目的属性页面来完成它。我怎么做到这一点?
4 个解决方案
#1
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.
只需右键单击解决方案资源管理器中的文件,然后单击属性选项是“使用公共语言运行时支持编译”,在C / C ++ - > General下。
#2
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...")
需要注意的一件事是预编译头文件。但是,您可以在混合项目中重新启用预编译的头文件。如果添加类似stdafx.mgd.cpp / stdafx.mgd.h的内容,然后对于为C ++ / CLI配置的每个文件,请将“使用PCH到文件”更改为stdafx.mgd.h并附加“.mgd” .pch“在下面的预编译头文件行的末尾...(必须与您用于stdafx.mgd.cpp的命名相匹配,并选择”创建预编译头文件......“)
Being so use to speedy C# compilation times, every little bit helps improve perf on the C++/CLI compiles... oh ya, dont forget /MP ;)
这样用来加快C#编译时间,每一点都有助于提高C ++ / CLI编译的性能......哦,你不要忘记/ MP;)
Sorry it's a bit off topic, but it's usually related/next-steps...
对不起它有点偏离主题,但它通常是相关的/下一步...
#3
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.
您仍然可以单击解决方案资源管理器中的文件/项目来更改您正在处理的范围。单击非托管.cpp文件以仅为该文件设置选项。
It's just one of those days :-)
这只是其中一天:-)
#4
Right click on filename on Solution Explorer > Properties > C/C++.
在解决方案资源管理器>属性> C / C ++上右键单击文件名。
#1
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.
只需右键单击解决方案资源管理器中的文件,然后单击属性选项是“使用公共语言运行时支持编译”,在C / C ++ - > General下。
#2
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...")
需要注意的一件事是预编译头文件。但是,您可以在混合项目中重新启用预编译的头文件。如果添加类似stdafx.mgd.cpp / stdafx.mgd.h的内容,然后对于为C ++ / CLI配置的每个文件,请将“使用PCH到文件”更改为stdafx.mgd.h并附加“.mgd” .pch“在下面的预编译头文件行的末尾...(必须与您用于stdafx.mgd.cpp的命名相匹配,并选择”创建预编译头文件......“)
Being so use to speedy C# compilation times, every little bit helps improve perf on the C++/CLI compiles... oh ya, dont forget /MP ;)
这样用来加快C#编译时间,每一点都有助于提高C ++ / CLI编译的性能......哦,你不要忘记/ MP;)
Sorry it's a bit off topic, but it's usually related/next-steps...
对不起它有点偏离主题,但它通常是相关的/下一步...
#3
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.
您仍然可以单击解决方案资源管理器中的文件/项目来更改您正在处理的范围。单击非托管.cpp文件以仅为该文件设置选项。
It's just one of those days :-)
这只是其中一天:-)
#4
Right click on filename on Solution Explorer > Properties > C/C++.
在解决方案资源管理器>属性> C / C ++上右键单击文件名。