Visual Studio* IDE: Choose Project and Build Application
Intel® Inspector
is a dynamic memory and threading error checking tool for users developing serial and multithreaded applications on Windows* and Linux* operating systems. This topic is part of a
tutorial
that shows how to find and fix
threading
errors using the
Intel Inspector
and a
C++
sample 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 threading errors:
Get Software Tools
You need the following tools to try tutorial steps yourself using the
tachyon_insp_xe
sample application:
- Intel Inspectorinstallation package and license
- .zipfile extraction utility
- Supported compiler (seeRelease Notesfor 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- Copy thetachyon_insp_xe.zipfile from the<install-dir>\samples\<locale>\C++\directory to a writable directory or share on your system. The default<install-dir>is belowC:\Program Files (x86)\Intel\(on certain systems, instead of).Program Files (x86), the directory name isProgram Files
- Extract the sample from the.zipfile.
- Samples are non-deterministic. Your screens may vary from the screen captures shown throughout this tutorial.
- Samples are designed only to illustrate theIntel Inspectorfeatures; they do not represent best practices for creating code.
Open a Visual Studio* Solution
- Choose.
- In theOpen Projectdialog box, open thetachyon_insp_xe\vc10\tachyon_insp_xe.slnfile to display thetachyon_insp_xesolution in theSolution Explorer.Thetachyon_insp_xe.slnsolution was created using the Visual Studio* 2010 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.
Choose a Startup Project
If the
find_and_fix_threading_errors
project is not the startup project (project typeface in the
Solution Explorer
is not bold),
- Right-click thefind_and_fix_threading_errorsproject in theSolution Explorer.
- ChooseSet as StartUp Project, which changes the project typeface to bold.
Understand Optimal Compiler/Linker Settings
You can use the
Intel® Inspector
to analyze memory and threading errors in both debug and release modes of C++ and Fortran binaries; however, 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
| Impact If Not Set Correctly
|
---|---|---|
Debug information
| Enabled ( /Zi or
/ZI )
| Missing file/line information
|
Optimization
| Disabled ( /Od )
| Incorrect file/line information
|
Dynamic runtime library
| Selected ( /MD or
/MDd )
| False positives or missing code locations
|
Basic runtime error checks
| Disabled (do not use
/RTC ;
Default option in Visual Studio* IDE)
| False positives
|
Compiler/Linker Property
| Correct Fortran Setting
| Impact If Not Set Correctly
|
Debug information
| Enabled ( /debug:full )
| Missing file/line information
|
Optimization
| Disabled ( /Od )
| Incorrect file/line information
|
Dynamic runtime library
| Selected ( /libs:dll/threads or
libs:dll/threads/dbglibs )
| False positives or missing code locations
|
Basic runtime error checks
| None ( /check:none )
| False positives
|
The sample code is already set. Follow these steps if you need to change settings for your application.
- If theSolutions Configurationdrop-down on the Visual Studio*Standardtoolbar is set toRelease, change it toDebug.
- Right-click thefind_and_fix_threading_errorsproject in theSolution Explorer, then choosePropertiesto display theProperty Pagesdialog box.
- In the left pane, choose.
- ChooseGeneraland verify theDebug Information Formatfield is set toProgram Database (/Zi)orProgram Database for Edit & Continue (/ZI).
- ChooseOptimizationand verify theOptimizationfield is set toDisabled (/Od).
- ChooseCode Generation. Verify theRuntime Libraryfield is set toMulti-threaded DLL (/MD)orMulti-threaded Debug DLL (/MDd)and theBasic Runtime Checksfield is set toDefault.
- In the left pane, chooseand verify theGenerate Debug Infofield is set toYes (/DEBUG).
- Click theApplybutton, then click theOKbutton to close theProperty Pagesdialog box.
Build and Test the Application
- Chooseto build all projects in the solution.
- Check the messages in theOutputwindow to confirm the build succeeded.
- Chooseto test the application.
- Check for non-deterministic application output similar to the following:Notice the off-color dots in the image. The cause: Threading errors.