A Win32 Console Application is one of the template choices available for Visual C++
that pops up when you create a new project. The Application Settings
should be set to Console application for the Application type:.
To start with a blank console project, click on Empty project under
Additional options:.
The Intel (R) Fortran Project type provides a separate set of project
templates; a Console Application is one of those options. The Application Settings should
be set to Empty project for the Console Application type:.
Compile Configurations
By default two configurations of your project will be generated.
You choose which configuration is currently being built via the
Solution Configurations popup
near the middle of the top toolbar.
- When the program is compiled in the Debug configuration, the .exe
and associated files will be placed in the bin\Debug subdirectory
- Similarly, when the Release configuration is built, the files will
go into the bin\Release subdirectory
These directory choices can be overridden. In particular, the
target for the Debug and Release builds
can be made the same (such as the project directory) so that the two versions of the .exe file
overwrite one another. The one you get is the one that was compiled last.
The options associated with these configurations are specified in the
project properties
dialog box. The list of properties in the left pane of the Property Pages window depends on
whether you have selected (highlighted)a solution, a particular kind of project, or a source file.
The list of properties in the right pane depends on your choice in the left pane and on
your choice in the Configuration popup at the top of the window. Your choices
are typically:
- Debug
- Release
- All Configurations
In this manner, you can set a special option for an individual source file in the
Release configuration, for example. Your choices are more limited
in All Configurations because you can change only settings that
are common to both the Debug and Release configurations.
The higher you stay in this hierarchy, the better; that way, changes are automatically
replicated across multiple files and/or configurations.
External Libraries
To build a code that makes use of libraries, the information in the following
sections will be helpful. We will use the Math Kernal Library(MKL) from Intel as an example of how
to include external libraries in your application. MKL provides a host of optimized
mathematical routines including linear algebra routines, discrete Fourier transforms,
vector transcendental math functions and vectorized statistical functions.
To make these routines available to your application:
- MKL must be installed on the machine where you are compiling the executable
(MKL is available on the winlogin nodes and in the Collaboratory)
- The MKL library must be added as an additional dependency to the Linker (To
add the MKL library as an additional
dependency go to
project properties; make sure that All Configurations is selected in
the Configuration: window, then go to Linker | Input
and add mkl_c.lib to the Additional Dependencies list)
- The MKL include path must be added either to the default path or as a project specific
path
- The MKL library path must be added either to the default path or as a project specific
path
Default paths
If you are going to be writing many programs using MKL, consider customizing your
VS .NET environment so that the include files
and libraries will be found automatically
for every project. Even on the winlogin nodes, VS .NET can be personalized to suit your needs.
But be aware that the winlogin nodes are separate machines, so any customization of VS .NET you do
on one login node will not automatically be applied to the others.
Go to:
-
[Microsoft C/C++]:
Tools | Options | Projects and Solutions| VC++ Directories
-
[Intel C/C++]:
Tools | Options | Intel(R) C++ | Directories
-
[Intel Fortran]:
Tools | Options | Intel(R) Fortran | Directories
Add:
-
[To the Include Files Section]:
C:\Program Files\Intel\MKL\8.0.1\Include
-
[To the Library Files Section]:
C:\Program Files\Intel\MKL\8.0.1\ia32\Lib
(These paths can be typed in or found by browsing.)
Project Specific Paths
If you don't set up default paths, each project will need to be customized by putting
in the include path and the
library path on its
properties page. This would make sense for a project that needs
specific libraries that none of your other projects need. Go to the project's
properties page and make sure that All Configurations shows in
the Configuration: window
- Microsoft and Intel C/C++:
- add C:\Program Files\Intel\MKL\8.0.1\Include
to C/C++ | General | Additional Include Directories
- add C:\Program Files\Intel\MKL\8.0.1\ia32\Lib
to Linker | General | Additional Libraries Directories
- Intel Fortran
- add C:\Program Files\Intel\MKL\8.0.1\Include
to Fortran | General | Additional Include Directories
- add C:\Program Files\Intel\MKL\8.0.1\ia32\Lib
to Linker | General | Additional Libraries Directories