File-specific compilation options in Visual Studio 2008

If I had a project structured like this...

a.cpp b.cpp c.cpp

...and I wanted to compile a.cpp and b.cpp with one set of compiler options, and c.cpp with another set, how would I do that?


I think the easiest way would be to separate them into different projects based on the compiler options you require, and then set up your dependencies appropriately to link them all into your final executable.

Depending on what options you need, exactly, you might be able to use the corresponding pragmas in the source code - e.g. #pragma optimize.

That said, be warned that, with some compiler options, files compiled with different ones may be binary incompatible - for example, /vmb vs /vmg.

One option is to create a new group (or 'filter' in VS.Net parlance) to make it obvious which group of files are affected by the particular settings. It can be something of a maintenance headache otherwise as it's difficult to see which files have got different settings without opening the .vcproj file in a text editor.

The simplest way (although not the easiest way to maintain) is to right click on your source file in Solution Explorer and select "Properties". From there you can customize your compiler options for the selected source file.

Need Your Help

special method for an object to override tuple expansion?

python class oop object overloading

I will provide an example of the problem in question, in case the title was not clear enough.

How to handle React js concurrency?

concurrency reactjs reactjs-flux

What is the better way to handle concurrency inside a flux store, when you have a lot of react js suscribed components to the same flux store ?.