views:

30

answers:

3

Can someone please point out where in the Visual Studio 2008 configurations I can set which .cpp files are used for a given build.

I'd like to use a different set(s) of .cpp files when I am doing a release vs.debug build.

Thanks!

+1  A: 

Your best bet to achieve that kind of behaviour would be to use #ifdef blocks to discriminate between debug and release code.

At the extreme case you could #ifdef a #include line of code that selectively includes other files.

I don't know of any normal way to dynamically change the .cpp files compiled in a project based on build type.

John Weldon
Ive seen various VS projects which seem to be managing this at the project level. The files which are being ignored appear with the standard red not used type of icon.I'm fairly certain this can be done above the code level but I'm just not certain where the option is located! : )
colordot
Hmm, sounds like the same ui that a VSS provider might display for a modified file. If you have the .vcproj file you could probably find out if there's something else by examining it in a text editor...
John Weldon
+1  A: 

I can open the property pages for any specific .cpp file in VS2008 (from the solution explorer). One of the properties in the general section is exclude from build yes/no. All these properties are configurable by build type.

I have used this to exclude some debug support files in release versions.

Elemental
+2  A: 

Select your configuration from Solution Configurations drop down and platform from Solution Platforms drop down on Standard toolbar. Right-click a cpp file and choose Properties. On the branch General set property Excluded From Build to Yes or No.

AOI Karasu