How to: Invoke Code Analysis for C/C++

Code analysis tool detects common coding errors, such as buffer overrun, un-initialized memory, null pointer dereferences, and memory and resource leaks.

Note

The code analysis tool is available in both Visual Studio Team System Development Edition or Visual Studio Team Suite.

To enable code analysis for C/C++ code

  1. Open a project in Visual Studio.

  2. On the Project menu, click Properties.

  3. Expand Configuration Properties and expand Code Analysis.

  4. Set Enable Code Analysis for C/C++ on Build to Yes (/analyze) and then click OK.

To disable code analysis for C/C++ code

  1. Open a project in Visual Studio.

  2. On the Project menu, click Properties.

  3. Expand Configuration Properties and expand Code Analysis.

  4. Set Enable Code Analysis for C/C++ on Build to No and then click OK.