Compiling using Intel C++11 in Visual Studio 2012

Compiling using Intel C++11 in Visual Studio 2012

Hi,

I recently encountered a serious problem that was preventing me from compiling using new C++11 features in Visual Studio 2012 after installing and changing over to the Intel C++ compiler. For archival purposes, you can see the problem below, however, I've put the solution as the first post as I feel that this is important and urge Intel to update their documentation to make this clearer.

For those using features that are not supported by Microsoft Visual C++11 (e.g. template aliases, constructor delegates, etc.) please do the following:

  1. Go to Tools in the menu.
  2. Select Options.
  3. Navigate your way to Intel Composer XE.
  4. Under the C++ section select compilers.
  5. There is a text box labelled "Default options"
  6. Replace "/Qvc11" with "/Qstd=c++11"
  7. If you're compiling for both Win32 and Win64, you will need to make the change for both platforms; this will only update Win32 by default. You can find a drop-down menu at the top of this page that is labelled "Target platform".

These steps are not clearly explained in the C++11 Features Supported by Intel® C++ Compiler documentation Intel provides.

Kind regards,

cjdb01

Original post:

In the middle of writing a program that's using C++11. Currently using:

    template <typename T> using twin    = std::tuple<T, T>;
    template <typename T> using triad    = std::tuple<T, T, T>;
    template <typename T> using quartet    = std::tuple<T, T, T, T>;
    template <typename T> using quintet    = std::tuple<T, T, T, T, T>;
    template <typename T> using sextet    = std::tuple<T, T, T, T, T, T>;
    template <typename T> using heptet    = std::tuple<T, T, T, T, T, T, T>;
    template <typename T> using octet    = std::tuple<T, T, T, T, T, T, T, T>;

This compiles fine under the latest version of MinGW, but not the latest version of Intel C++. I was under the impression that Intel were supporting the majority of C++11 features including template aliases. I'm using Visual Studio 2012 with Intel Parallel Studio 13 Trial (I assume this means that Intel's compiler has been integrated with VS as a 'parallel' system).

What can be done to resolve the situation? I know a complaint was placed here here around this time last year and the issue was promised to be fixed in Composer 12.1, but it doesn't seem to have been carried over to the most recent version.

Thanks,

cjdb01

4 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Hi,

I managed to fix the problem myself. It appears that I was still compiling using Visual C++11 instead of Intel C++11 (even though I'd changed compilers for the project). If anyone else has a problem similar to this, here's what you need to do:

1. Go to Tools in the menu.
2. Select Options.
3. Navigate your way to Intel Composer XE.
4. Under the C++ section select compilers.
5. There is a text box labelled "Default options"
6. Replace "/Qvc11" with "/Qstd=c++11"
7. If you're compiling for both Win32 and Win64, you will need to make the change for both platforms; this will only update Win32 by default.

Could Intel please provide details on how this can be done so that others don't make the same mistake that I have?

Kind regards,

cjdb01

Jennifer J. (Intel)的头像

The method you discovered is a good one if you want to use Intel C++ for all your projects with /Qstd=c++11 enabled.

But if you only have some with C++11, but others without, you have to reset it back for the others.

Another method is to set the /Qstd=c++11 in the project property, you do it with following steps:
1. set the project to use Intel C++ by right click on the project name, select "Intel C++ Composer XE -> Use Intel C++"
2. open the project's properties dialog, select C/C++-> Language[IntelC++], set
"Enable C++ 0x Support" to "Yes (/Qstd=c++0x".
*** /Qstd=C++0x is the same as /Qstd=C++11

One more method is to use Property-sheet: create a "Intel C++11.props" file, and import it for the project you want to use the Intel C++ 11 feature.

Jennifer

Vladimir Polin (Intel)的头像

hello,

Can't it be related to issue posted there http://code.google.com/p/googletest/issues/detail?id=408? we use std::tuple and tbb::tuple in Intel TBB library and it is built fine by this compiler.

--Vladimir

登陆并发表评论。