Visual Studio* IDE: Choose Project and Build Application

Follow these steps only if you are using the Intel Inspector plug-in to the Visual Studio* IDE to complete this tutorial.

To create an application the Intel Inspector can inspect for memory errors:

Get Software Tools

You need the following tools to try tutorial steps yourself using the tachyon_insp_xe sample application:

  • Intel Inspector, including sample applications

  • .zip file extraction utility

  • Supported compiler (see Release Notes for more information)

Acquire the Intel Inspector

If you do not already have access to the Intel Inspector, you can download an evaluation copy from http://software.intel.com/en-us/articles/intel-software-evaluation-center/.

Install and Set Up the Intel Inspector Sample Applications

  1. Copy the tachyon_insp_xe.zip file from the <install-dir>\samples\<locale>\C++\ directory to a writable directory or share on your system. The default <install-dir> is below C:\Program Files (x86)\Intel\ (on certain systems, instead of Program Files (x86), the directory name is Program Files).

  2. Extract the sample from the .zip file.

Note

  • Samples are non-deterministic. Your screens may vary from the screen captures shown throughout this tutorial.

  • Samples are designed only to illustrate the Intel Inspector features; they do not represent best practices for creating code.

Open a Visual Studio* Solution

  1. Choose File > Open > Project/Solution.

  2. In the Open Project dialog box, open the tachyon_insp_xe\vc9\tachyon_insp_xe.sln file to display the tachyon_insp_xe solution in the Solution Explorer.

    Note

    The tachyon_insp_xe.sln solution was created using the Visual Studio* 2008 IDE. If the Visual Studio* conversion wizard appears, follow the steps to convert the solution to run on your installed version of the Visual Studio* IDE.


    Solution Explorer

Choose a Startup Project

If the find_and_fix_memory_errors project is not the startup project (project typeface in the Solution Explorer is not bold),

  1. Right-click the find_and_fix_memory_errors project in the Solution Explorer.

  2. Choose Set as StartUp Project, which changes the project typeface to bold.

Verify Optimal Compiler/Linker Settings

You can use the Intel® Inspector to analyze:

  • Memory errors in debug and release modes of:

    • C++ binaries - The Intel Inspector can analyze native code in native and mixed native/managed binaries.

    • Fortran binaries - The Intel Inspector can analyze native code in native binaries.

  • Threading errors in debug and release modes of:

    • C++ binaries - The Intel Inspector can analyze native and managed code in native, managed, and mixed native/managed binaries.

    • Fortran binaries - The Intel Inspector can analyze native code in native binaries.

Applications compiled/linked in debug mode using the following settings produce the most accurate and complete analysis results.

Compiler/Linker Property

Correct C/C++ Setting

Correct Fortran Setting

Impact If Not Set Correctly

Debug information

Enabled (/Zi or /ZI)

Enabled (/debug:full)

Missing file/line information

Optimization

Disabled (/Od)

Disabled (/Od)

Incorrect file/line information

Dynamic runtime library

Selected (/MD or /MDd)

Selected (/libs:dll/threads or libs:dll/threads/dbglibs )

False positives or missing code locations

Basic runtime error checks

Disabled (do not use /RTC; Default option in Visual Studio* IDE)

None (/check:none)

False positives

  1. Right-click the find_and_fix_memory_errors project in the Solution Explorer.

  2. Choose Properties to display the Property Pages dialog box.

  3. Verify the Configuration drop-down list is set to Debug or Active(Debug).

  4. In the left pane, choose Configuration Properties > C/C++.

    • Choose General and verify the Debug Information Format field is set to Program Database (/Zi) or Program Database for Edit & Continue (/ZI).

    • Choose Optimization and verify the Optimization field is set to Disabled (/Od).

    • Choose Code Generation. Verify the Runtime Library field is set to Multi-threaded DLL (/MD) or Multi-threaded Debug DLL (/MDd) and the Basic Runtime Checks field is set to Default.

  5. In the left pane, choose Configuration Properties > Linker > Debugging and verify the Generate Debug Info field is set to Yes (/DEBUG).

Verify the Application is Set to Build in Debug Mode

  1. Click the Configuration Manager button.

  2. Verify the Active solution configuration drop-down list is set to Debug.

  3. Click the Close button to close the Configuration Manager dialog box.

  4. Click the OK button to close the Property Pages dialog box.

Build and Test the Application

  1. Choose Build > Build Solution to build all projects in the solution.

  2. Check the messages in the Output window to confirm the build succeeded.

  3. Choose Debug > Start Without Debugging to test the application.

  4. If the Visual Studio* IDE responds any projects are out of date, click Yes to build.

  5. Check for application output similar to the following:

    Application output

    Notice the application output window is empty. The cause: Memory errors. This is how the application output should look after various memory errors are resolved:

    Application output

Key Terms

False positive


Studio-specific supplemental documentation may be available at <install-dir>\<studio>\documentation\ .

For more complete information about compiler optimizations, see our Optimization Notice.