tags:

views:

260

answers:

3

Hello.

Microsoft nmake tool will output any compiler warnings during build process. This is very annoying while building large projects (like Qt). Is it possible to disable warnings display while using nmake?

A: 

For Microsoft's C/C++ compiler you can disable spesific warnings from the code using #pragma directives

#pragma warning(disable:4005)

This will disable warning 4005. When you have included the suspect code, you can re enable the warning:

#pragma warning(default:4005)
Arve
Yes, but for large projects this will require to change 10000+ of source files :). What i'm interested in - is it possible to disable warnings on 'nmake' utility level.
Eye of Hell
A: 

first of all, the absolute majority of warnings should be taken in consideration and "resolved".

secondly, you can use #pragma as indicated Arve

the third solution see here:

To disable all compiler warnings

  1. With a project selected in Solution Explorer, on the Project menu click Properties.
  2. Click the Compile tab.
  3. Select the Disable all warnings check box.

To disable a single compiler warning

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.
  2. Click the Compile tab.
  3. In the Default Compiler Options table, set the Notification value for the warning to None.

To treat all compiler warnings as compilation errors

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.
  2. Click the Compile tab.
  3. Select the Treat all warnings as errors check box.

To treat a single compiler warning as a compilation errors

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.
  2. Click the Compile tab.
  3. In the Default Compiler Options table, set the Notification value for the warning to Error.
serhio
As a programmer i always use warning level 4 and my code don't have any warnings :). But large open source cross-platform projects, like Qt, Blender, GIMP etc tends to have a 1000's of warnings and normally don't have a solution :(.
Eye of Hell
+1  A: 

Not nmake is showing you the warnings, but the compiler/tools/scripts that are used. So you have to look into your Makefile, find out which programs nmake is calling and look into their documentation about the command line options of this tools. For example, for the Microsoft C++ command line compiler cl, you can add "/w" to disable all warnings. cl /? will show you the list of available options. For other programs, other command line options may be appropriate.

If you really do not like to see any output, you can call

nmake >nul: 2>nul:

sending all output to nirwana, but I am pretty sure that is not what you want.

Doc Brown
Normally Microsoft nmake uses Microsoft C and C++ compilers. Is it any way to supply the /w key from nmake or as some gloval directive in makefile?
Eye of Hell
Look here http://msdn.microsoft.com/en-us/library/d7ahf12s%28VS.71%29.aspx to find out more about the redefineably option macros of *Nmake*. But you will have to look into the Makefile to find out if those macros aren't already overwritten there.
Doc Brown