Intel® C++ Compiler Compatibility with Microsoft* Visual C++*

Submit New Article

Last Modified On :   November 20, 2008 3:28 PM PST
Rate
 


Table of contents

  1. Introduction
  2. General Compatibility
  3. User Interface Compatibility
  4. References

 


Introduction

The Intel® Parallel Composer is a compiler & library suite that can help you add threaded features and express parallelism in your application for high performance in a simpler productive way. It consists of the Intel® C++ Compiler for Windows* for IA-32 and Intel 64, Intel® Parallel Debugger Extension to Visual Studio*, Intel® Threading Building Blocks, and Intel® Integrated Performance Primitives. It is integrated into Visual Studio 2005* standard edition or above, and Visual Studio 2008* standard edition or above.

The Intel C++ Compiler is source and binary compatible with Visual C++ compiler; it supports the Microsoft* Visual C++* extensions to the C and C++ languages.

This document describes the important differences of the Intel C++ Compiler and Visual C++ Compiler.


Overview

The Intel C++ Compiler is source- and binary- (native code) compatible with the Microsoft* Visual C++* Compiler. It is well integrated into the following Microsoft development environments: Microsoft Visual C++ 2005 and Microsoft Visual C++ 2008. The Intel C++ Compiler generates optimized code with the advanced features of Intel® IA-32 processors and Intel® 64 processors.

Because of the source- and binary- compatibility, it enables you to harness the performance-enhancement features of the Intel C++ Compiler by selectively rebuilding only the parts of your application which you deem to be performance sensitive with the Intel Compiler. If necessary, you can mix and match object files and libraries built with either the Intel C++ Compiler or Microsoft Visual C++ Compiler.

The Intel C++ Compiler for Windows conforms to the following standards:

  1. ANSI/ISO standard ISO/IEC 9899:1990 for C language. C99 features are mostly supported.
  2. ANSI/ISO standard ISO/IEC 14882:1998 for C++ language
  3. OpenMP* 3.0 API specification

 


General Compatibility

Compatibility Options

The following Intel® Compiler options provide compatibility with different versions of Microsoft Visual C++:

  • /Qvc8 Microsoft Visual C++ 2005
  • /Qvc9 Microsoft Visual C++ 2008

 

If your program is built with both Intel C++ compiler and Visual C++ compiler, be sure to use the correct option when building with Intel C++ compiler. But in most cases this is taken care of for you.

  • From the build environment window, the Intel C++ compiler driver icl.exe will set the corresponding compatibility option automatically if “cl.exe” is on the path.
  • From within Visual Studio IDE, the Intel C++ Compiler IDE integration will set the option automatically.

 


Remark, Warning, and Error Diagnostics

The Intel compiler is more verbose than Visual C++ and may emit more warnings and/or errors. The warning or error numbers are specific to the Intel C++ Compiler and may not match the diagnostic number emitted by Visual C++.

You can always disable the diagnostic if there’s a number associated to it, or use “-w” to disable all warning messages, or use “/Qdiag-disable:list” to disable a list of diagnostics.

We have an on-going project to document all the diagnostic messages emitted by the Intel C++ Compiler. There will be a Knowledge Base article for each diagnostic that will eventually contain detailed information about the diagnostic as well as examples. Right now all of the diagnostic articles are already published except only a few. If you'd like to see detailed information for a particular diagnostic, please send us a request on the diagnostic article you're interested.

To find all the diagnostic articles, visit http://software.intel.com/en-us/articles/intel-parallel-composer/all/1 and click "Error Message".


Differences in Precompiled Header (PCH) Support

The precompiled header (PCH) information generated by the Intel C++ Compiler is not compatible with the PCH information generated by the Microsoft Visual C++ compiler. The specific incompatibilities are as follows:

  • The Intel Compiler does not recognize the PCH file generated by the Microsoft compiler. If no suitable or recognized PCH file exists, compilation proceeds without use of PCH files.
  • The Microsoft compiler aborts with an error message when it tries to use a PCH file generated by the Intel compiler.
  • The Intel C++ Compiler does not support PCH generation and use in the same translation unit.
  • The Intel C++ Compiler does not generate PCH information beyond the point where a declaration is seen in the primary translation unit. But Visual C++ will generate the pch information for all the include files.
  • PCH files coexistence: the /Qpchi option causes the Intel C++ Compiler to name its PCH files with a .pchi filename suffix and reduce build time. The /Qpchi option is on by default; use /Qpchi- to turn it off.

 


Unsupported Major Language Features
  • Attributed code
  • Managed extensions for C++ (new pragmas, keywords, and command-line options)
  • Event handling (new keywords)
  • __abstract keyword
  • __box keyword
  • __delegate keyword
  • __gc keyword
  • __identifier keyword
  • __nogc keyword
  • __pin keyword
  • __property keyword
  • __sealed keyword
  • __try_cast keyword
  • __w64 keyword

 


Unsupported Preprocessor Features
  • #import directive for attributed code
  • #using directive
  • managed, unmanaged pragmas
  • _MANAGED macro
  • runtime_checks pragma

 


Unsupported Compiler Options

The Intel C++ Compiler for Windows does not support all the features of Microsoft Visual C++ 2005 and 2008. The details are discussed below.

Table 1, Most Unsupported Compiler Options of Visual C++ 2005 and Visual C++ 2008.

Option Description
/AI<dir> Adds to assembly search path
/clr Compiles for the common language runtime (managed C++)
/FU<file> Forces use of assembly/module
/Fx Merges injected code to file
/Fd Name the PDB file used for debug information for specified source files.
/openmp Use /Qopenmp instead
/Zm<n> Maximum memory allocation (percentage of the default)
/homeparams Force parameters passed in registers to be written to the stack
/doc[fle] Process XML documentation comments and optionally name the .xdc file
/favor:[blend|AMD64|EM64T] Use /QaxSSE3, /arch:SSE2, and /QxSSE3 instead. You can find more up to date information at Intel® compiler options for SSE generation and processor-specific optimizations
/Yd Put debug information in every object (Microsoft PCH-specific option)

 


Mixing Unmanaged Code Compiled with the Intel C++ Compiler with Managed Code

If you use the managed extensions to the C++ language in Microsoft Visual C++, you can use the Intel C++ Compiler for your non-managed code for better application performance. Make sure managed keywords do not appear in your non-managed code.

For information on how to mix unmanaged code and managed code, refer to the article, "An Overview of Managed/Unmanaged Code Interoperability", at the Microsoft Web site: <<http://msdn2.microsoft.com/en-us/library/ms973872.aspx>>.

Note: This URL is available at the Microsoft MSDN* Web site. If it changes, please search for the article.


Compatibility in OpenMP* Support

Visual C++ 2005, Visual C++ 2008 and the Intel C++ Compiler all support OpenMP*. However, Visual C++ 2005 supports the OpenMP 2.0 API specification. Visual C++ 2008 supports OpenMP 2.5.
The Intel C++ Compiler supports the OpenMP 3.0 API specification. It provides the OpenMP compatibility libraries that are compatible with Visual C++ 2005 and 2008.

Table 2, Intel C++ Compiler OpenMP Compatibility Libraries

Library Types Intel C++ Compiler OpenMP Compatibility Libraries
Dynamic libiomp5md.lib
libiomp5md.dll

 

Static libiomp5mt.lib

 

List of OpenMP features supported by Intel C++ Compiler

The following list briefly summarizes OpenMP support in the Intel C++ Compiler for Windows:

  1. Support for the OpenMP 3.0 API specification.
  2. By default Intel C++ Compiler supports OpenMP tasking model, but it also support the Intel® taskqueuing extension under the option /Qopenmp-task:intel. When this value is specified, OpenMP 3.0 tasking pragmas are ignored; if they are specified, warnings are issued.

Note: The taskqueuing extension implemented by the Intel C++ compiler extends OpenMP to parallelize a broader range of applications. It allows the user to exploit irregular parallelism with units of work that are not pre-computed at the start of the worksharing construct. Unlike single, for, and sections constructs, all work units are known at the time the construct begins execution.

The taskqueuing pragmas are #pragma taskq and #pragma task. The #pragma taskq specifies the environment within which the enclosed units of work (tasks) are to be executed. From among all the threads that encounter a taskq pragma, one is chosen to execute it initially. The #pragma task specifies a unit of work, potentially executed by a different thread. (#pragma intel_omp_taskq and #pragma intel_omp_task).

  1. Implemented extension functions in the OpenMP run-time library and implemented extension environment variables
  2. Support for debugging OpenMP code
  3. Support for enhanced debugging by providing an OpenMP stub library for debugging purposes that links in the OpenMP stub APIs but still runs sequentially; this is supported through the /Qopenmp_stub option

 

Difference in Supporting Threadprivate

The Microsoft Visual C++* compiler uses a different mechanism than the Intel compilers to reference threadprivate data. If you declare a variable as threadprivate in your code and you compile the code with both Intel compilers and Visual C++ compilers, the code compiled by the Intel compiler and the code compiled by the Visual C++* compiler will reference different locations for the variable even when referenced by the same thread. Thus, use the same compiler to compile all source modules that use the same threadprivate objects.


User Interface Compatibility

Integration with Microsoft Visual Studio IDE

The Intel C++ Compiler for Windows is integrated into Microsoft Visual Studio 2005 and 2008 IDEs through the Visual Studio Industry Partner (VSIP) interfaces. The integration module of the Intel C++ Compiler provides a toolbar for the IDE, manages an option dialog, and maintains the Intel C++ project system for each project.

Microsoft Visual Studio maintains a .vcproj file for the Visual C++ project, and the Intel C++ project system maintains a corresponding file, .icproj, that contains the configuration data specific to the Intel C++ Compiler. In order to use the Intel C++ Compiler, you need to associate your project or solution with the Intel C++ project system first. After that, a new .icproj file will be created for the selected .vcproj project(s) or all the projects of the solution.

There are two ways to associate a Visual C++ project or projects or solution with the Intel C++ project system:

  • From the Visual Studio IDE (RECOMMENDED):
    1. Right-click on the project(s) or the solution, then select the menu item “Use Intel C++”
    2. Or select the project(s) you’d like to use Intel C++ Compiler to build, then select menu item [Project]->[Use intel C++]
    3. Or select the project(s), then click the 2st icon on the Intel C++ Compiler’s toolbar icltoolbar.JPG
    4. The 3nd icon will revert the work.
  • From the Intel C++ Compiler’s build environment window, use “ICProjConvert110.exe”.

 

Both above methods do not change any of the .vcproj files, but only the .sln file. So it’s perfectly ok to use the Intel C++ Compiler among a development team.

The following capabilities are provided by the integration:

  • Set one or more Visual C++ projects in a solution to use the Intel C++ Project System.
  • Selecting either the Intel C++ Compiler or the Microsoft Visual C++ Compiler to build a configuration of a project or individual files within a project.
  • Optimizing your application using compilation options specific to the Intel C++ Compiler
  • Selection of the version of the Intel C++ Compiler to use when multiple versions are installed on your system
  • Easy use of Intel® Integrated Performance Primitives (IPP) and Intel® Threading Building Blocks (TBB) through the Component Selection dialog (the 4th icon on the toolbar) icltoolbar.JPG.

 


Features of the IDE Integration

The following features have been added to the Intel C++ Compiler 11.0 for Windows.

  • Support manifest tool automation
  • Support IVSFileBackup – In case of unexpected Visual Studio termination, the .vcproj and .icproj files may be recovered to a certain point.
  • Support for the Inherited Project Property feature
  • Support for the Custom Build Rule feature
  • support the Remote Debugging
  • Support for the automation interfaces of the Intel C++ Project System
  • Intel C++ Compiler toolbar icltoolbar.JPG created to make it easier to use the Intel C++ Compiler, IPP and TBB.

 


Debugging Capability and the Intel Parallel Debugger Extension

The Intel C++ Compiier is fully source- and binary- (native code only) compatible with Visual C++ 2005 or Visual C++ 2008 compiler when the option “/Qvc8” or “/Qvc9” is specified. Binaries built with the Intel C++ Compiler can be debugged from within the Microsoft Visual C++ IDE.

It’s possible to build only several files or build several projects with the Intel C++ Compiler.

Intel Parallel Debugger Extension is a plug in to Visual Studio Debugger. It provides great functionalities for debugging parallel programs. Please see the


Unsupported Visual C++ Project Types

The Intel C++ Compiler only supports native C++ project types provided by Visual Studio 2005, and Visual Studio 2008. The project types with .NET attributes such as the ones below cannot be converted to an Intel C++ project:

  • Empty Project (.NET)
  • Class Library (.NET)
  • Console Application (.NET)
  • Windows Control Library (.NET)
  • Windows Forms Application (.NET)
  • Windows Service (.NET)

 


Whole Program Optimization and Interprocedural Optimization

Visual Studio 2005 and Visual Studio 2008 all support the optimization “Whole Program Optimization” (/GL). The equivalent optimization of the Intel C++ Compiler is the Interprocedural Optimization (/Qipo). Each compiler will create object files with their own proprietary IR (intermediate representation) and the linker will perform the “Whole Program Optimization” or “Interprocedural Optimization”.

In order to get optimal performance, we do not recommend mixing and matching object files compiled by different compilers with “Whole Program Optimization” option. Cross-file optimizations cannot be performed amongst files compiled with the Intel compiler and those compiled by the Microsoft compiler. So, all the optimizations of “Whole Program Optimization” that would have been performed if all of the files were compiled with the Intel compiler will not be performed, which could potentially have a dramatically negative impact on performance.

If you do need to mix and match object files, you should use the tools (ie icl, xilink, or xilib) provided with the Intel C++ Compiler. These tools will emit the following warning in this case and continue linking with the Whole Program Optimization disabled:

    IPO: WARNING #11021: Whole program optimization will be disabled;
    "test.obj" appears to be a Microsoft(R) /GL compiled object file.
    Recompile with the Intel(R) compiler using the /GL option for whole program optimization.

 

If you use the link tools (link.exe, lib.exe) provided with Visual C++, you'll get the following warning and errors:

    t2.obj : warning LNK4229: invalid directive '/Intel(R) compiler non-linkable IL object file' encountered; ignored
    xxx.obj : error LNK2001: unresolved external symbol "int __cdecl foo(void)" (?foo@@YAHXZ)
    xxx.exe : fatal error LNK1120: 1 unresolved externals

If you build the project within the Visual Studio IDE, the Intel C++ Compiler integration will cause the correct linking tools to be used.

Visual Studio 2005 and 2008 provides the following refined options under the “Whole Program Optimization” option:

  • Use Link Time Code Generation
  • Profile Guided Optimization - instrument
  • Profile Guided Optimization – update
  • Profile Guided Optimization – optimize

    With this option only, if you have some files compiled with the Intel C++ Compiler, you’ll get the following link error:

    LINK : fatal error LNK1269: inconsistent file 'ipo_xxxxobj.obj' specified with /LTCG:PGOPTIMIZE but not with /LTCG:PGINSTRUMENT

The first three options will not cause any link errors. But, the “Profile Guided Optimization –instrument/update” options will not have any effect on the files compiled with the Intel C++ Compiler.

 


The Intel®-64-based Processor Targeting

The Intel C++ Compiler for Windows supports targeting for Intel 64-based systems from within the Visual Studio 2005 or 2008 IDE, but you can develop Intel 64-based applications from the command window as well.

To build Intel 64-based applications from within Visual Studio IDE, you need to install the Visual Studio 2005 or 2008 Standard edition or above, and the “X64 Compiler and Tools” component. Also, you should use the “/favor:INTEL64” option for best performance on Intel 64-based systems when using Visual C++ 2008 (“/favor:EM64T” for Visual C++ 2005), and use “/QxSSE3” when using the Intel C++ Compiler.

The following special features are offered by the Intel® C++ Compiler for Intel 64:

  1. support for inline assembly
  2. support for MMX/x87 instructions through inline assembly
  3. support for MMX™ instructions through intrinsics

 


References

You can find useful information about compiler compatibility in the following documents, each of which is available from the web site:

  • Intel® Parallel Composer Release Notes
  • The Intel® C++ Compiler User and Reference Guides

 

To download the Intel(R) Parallel Composer evaluation package, visit

http://software.intel.com/en-us/articles/intel-parallel-studio

Intel, the Intel logo, Intel Leap ahead, and Intel Leap ahead logo, Pentium, and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

*Other names and brands may be claimed as the property of others.

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL’S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life saving, life sustaining applications. Intel may make changes to specifications and product descriptions at any time, without notice.

Copyright © 2008, Intel Corporation. All Rights Reserved.

 





This article applies to: Intel® Parallel Composer Knowledge Base