views:

559

answers:

4

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?

A: 

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 :-)

unforgiven3
+1  A: 

Right click on filename on Solution Explorer > Properties > C/C++.

dirkgently
+1  A: 

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.

Promit
+1  A: 

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...

RandomNickName42
Good tip! thanks!
unforgiven3