Rob
Rob

Reputation: 26324

VC2008, how to turn CLR flag off for individual files in C++/CLI project

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?

Upvotes: 2

Views: 14378

Answers (4)

RandomNickName42
RandomNickName42

Reputation: 5955

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

Upvotes: 3

Promit
Promit

Reputation: 3507

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.

Upvotes: 7

dirkgently
dirkgently

Reputation: 111140

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

Upvotes: 0

Rob
Rob

Reputation: 26324

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

Upvotes: 0

Related Questions