views:

39

answers:

3

I am trying to compile and build a project(s) in visual studio and I started looking into compiling with the /Wall option which gives all warnings. I am wondering iof there is a way to run this only on those files I am interested in, since currently I get a million warnings on files i have no ability or desire to change.

+4  A: 

In the Solution Explorer select the files you want all warnings for, right click and select Properties. From there you can adjust whatever compiler settings you want to for those files, just about like you would for the entire project.

Jerry Coffin
A: 

If there is a Makefile (or equivalent) for your part of the project (e.g. a directory), then you may be able to add the the /Wall warning flag only for that part

WARNING_FLAGS += /Wall

(It still is not per file, but this may be more manageable.)

Another option is to put all the warning messages and filter (e.g. grep) for the file names you are interested.

ArunSaha
VS doesnt use makefiles by default.
John Dibling
@John: I bet. I specifically wrote "or equivalent" to cover that, but still got down-voted :(
ArunSaha
In the VS world, you wouldn't edit some file to make a change like this. You use the IDE's GUI. Not my dv tho.
John Dibling
A: 

Another approach that can work is to use the #pragma warning( ... ) modifiers.

This lets you controls specific warnings as well as the overall setting. See the documentation at http://msdn.microsoft.com/en-us/library/2c8f766e(v=vs.80).aspx

If a library or subproject causes a problem then you might be able to turn off warnings for it in a single place.

Modifying the project file for subsets of your files can get very messy very quickly, especially if you have multiple architectures and targets (debug, release, ...)

I prefer to modify the project files by hand in a text editor for this type of change so I am sure that everything is happening as expected.

Rob Walker