Kifsif
Kifsif

Reputation: 3843

Visual Studio: how to cope with warnings

I use Visual Studio 2010 to program in C.

When the debugger meets an error, the compiler stops and suggests me to eradicate the error. But in case of a warning, it doesn't stop. At least I can't find such a tool in Debug /Option and Settings. Well, the debugger doesn't stop, the program compiles. And I can't even have a look at the warnings. But I would like to fix them too.

Could you recommend me what to do?

Upvotes: 0

Views: 62

Answers (2)

JasonD
JasonD

Reputation: 16582

It sounds like you're hitting one of the 'start' options rather than just 'build'. That results in your project building, then if successfully built (and a warning does not typically prevent that, though an error does) it will run, seemingly clearing the output window so you can see the program's output.

However the build output has not actually gone away - the output can be switched back to the build output in a drop-down at the top of the output window.

I think if you're mostly concerned with fixing errors and warnings, you should just 'build' rather than starting the project.

Otherwise the Treat Warnings As Errors option is in the project properties, under C/C++ -> General.

Upvotes: 1

Daniel A. White
Daniel A. White

Reputation: 190907

Depending on the compiler you are using, there are switches to treat compilation warnings as errors. Some can turn all on or you could be explicit with the certain error code.

Upvotes: 0

Related Questions