作为错误的警告-如何摆脱这些

我不知道如何去除那些不应该在 Visual Studio 2010中停止我的编译,也不应该是 show-stop 的错误(稍后我会修复它们)。我不希望编译器只是返回一个错误,然后停止处理这类问题。

例如,我得到以下错误:

错误1作为错误的警告: XML 注释 开始 ‘拧转,维基,搜索引擎,相关性,终结(浮动)’ 有一个“ IsFinalize”的 parref 标记, 但是没有该名称的参数 C: www Wiki Screwtur3 _ 0 _ 2 _ 509 SearchEngine 关联网站 6070 SearchEngine

对于这个代码:

  /// <summary>
/// Normalizes the relevance after finalization.
/// </summary>
/// <param name="factor">The normalization factor.</param>
/// <exception cref="InvalidOperationException">If <paramref name="IsFinalized"/> is <c>false</c> (<see cref="M:Finalize"/> was not called).</exception>
public void NormalizeAfterFinalization(float factor) {
if (factor < 0)
throw new ArgumentOutOfRangeException("factor", "Factor must be greater than or equal to zero");


if (!isFinalized)
throw new InvalidOperationException("Normalization can be performed only after finalization");
value = value * factor;
}

我查看了菜单 工具-> 选择,但我不知道在哪里可以调整编译器,告诉它不要担心注释或基于 XHTML 的错误。

138849 次浏览

Each project in Visual Studio has a "treat warnings as errors" option. Go through each of your projects and change that setting:

  1. Right-click on your project, select "Properties".
  2. Click "Build".
  3. Switch "Treat warnings as errors" from "All" to "Specific warnings" or "None".

The location of this switch varies, depending on the type of project (class library vs. web application, for example).

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. (or Build Tab may be there)
  3. Select the Treat all warnings as errors check box. (or select the build setting and change the “treat warnings as errors” settings to true.)

and if you want to get rid of it

To disable all compiler warnings

  1. With a project selected in Solution Explorer, on the Project menu click Properties.
  2. Click the Compile tab. (or Build Tab may be there)
  3. Select the Disable all warnings check box. (or select the build setting and change the “treat warnings as errors” settings to false.)

For Visual Studio Express 2013 to get rid of these problem you have to do the following.

Right click on your project click Properties. In properties window from left menus select Configuration Properties->C/C++->General

In right side select

Treat Warning As Errors NO

and

SDL Checks NO

The top answer is outdated for Visual Studio 2015.

English:

Configuration Properties -> C/C++ -> General -> Treat Warning As Errors

German:

Konfigurationseigenschaften -> C/C++ -> Allgemein -> Warnungen als Fehler behandeln

Or use this image as reference, way easier to quickly mentally figure out the location:

enter image description here

In the Properties,

Go to Configuration Properties. In that go to C/C++ (or something like that). ,Then click General ,In that remove the check in the "Treat Warning As Errors" Check Box

You can control the behavior in a headerfile or C-file:

#pragma warning(error:4003) //not enough actual parameters for macro

yet tested with Visual studio 2015. I have a common headerfile 'compl_adaption.h' for such things, included in all files, to set this behavior for all my projects compiled on visual studio.

VS 2019

Just for people using VS2019, I think other answers are also pointing out same location.

View -> Error list -> Right click on specific Error/Warning.

You can change Severity as You want.

To fix this issue with VS 2019, I did the following:

  • Right clicked project
  • Clicked "Properties"
  • Clicked "C++"
  • On the right side, set table value "Treat Warnings As Errors" to "No"
  • Set the configuration (topleft value) to "Debug" and "x64". This may be different for your project depending on what you are doing
  • Closed "Properties" menu
  • Set configuration of project as "Debug" and "x64"
  • Restarted Visual Studio (closed and re-opened it)

Worked like a charm.

I was facing this issue in VS2019 and when I would change it at the Projects Properties UI it would magically return (probably set as default at a higher level)

enter image description here

When using the SDK style CSProj files:

<Project Sdk="Microsoft.NET.Sdk">

adding this PropertyGroup solved the issue:

  <PropertyGroup>
<NoWarn>;NU1605</NoWarn>
</PropertyGroup>