2

I am trying to find out why the Intel Compiler 18.0, which got installed after my Visual Studio 2017 installation, uses the header files of MSVC, instead of it's own one (since it results in errors).

A simple #include <vector> triggers this error in an otherwise empty translation unit when compiled in a C++ project within Visual Studio

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\type_traits(1562): error : expected a ">"
1>      _INLINE_VAR constexpr bool _Is_specialization_v<_Template<_Types...>, _Template> = true;

Just to be sure, why is it using the MSVC includes anyway? A reinstallation did not result in any change. I simply can't figure out, why it's causing this problem. Any ideas?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Daniel Stephens
  • 2,371
  • 8
  • 34
  • 86

2 Answers2

2

Sounds like you need to turn off "Conformance Mode" (/permissive-) for configurations that use the Intel compiler! (This mode forces stricter adherence to standards, which Intel C++ can't handle when using the MSVC implementation of the STL.)

Right-click project: Properties -> C/C++ -> Language then select "No" for Conformance Mode.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • Thanks, I will give it a try, I am just wondering though why it uses these headers at all. Shouldn’t it use its own ones? – Daniel Stephens Oct 08 '19 at 11:31
  • 1
    I think the point is that Intel C++ tries to be 'completely' compatible with Visual Studio and/or MSVC. For example, when building MFC apps - I don't think Intel would want to 'take ownership' of MFC, or that Microsoft would even let them. – Adrian Mole Oct 08 '19 at 11:33
  • I agree, but a plain C++ project, before it used its own headers. I can’t switch simply now to different ones. Hm – Daniel Stephens Oct 08 '19 at 11:48
2

About the error message you got:

I think you're experiencing the same issue like this one, in most time this issue is caused by the incompatibility between Intel Parallel Studio XE version and VS version. Just like what I suggested in your another thread, you need to install the higher version of Intel Parallel Studio XE version to resolve the issue.

Just to be sure, why is it using the MSVC includes anyway? A reinstallation did not result in any change. I simply can't figure out, why it's causing this problem. Any ideas?

Intel C++ Compiler works an extension for VS. You can check it in Tools=>Extensions and Updates:

enter image description here

Agree with Adrian's I don't think Intel would want to 'take ownership' of MFC. For a simple C++ project, if we set Intel C++ compiler as its compiler, what would exactly happen behind? Let's see the project file(xx.vcxproj):

It sets the <PlatformToolset>Intel C++ Compiler 19.0</PlatformToolset>, and may do some other changes to the xx.vcxproj, but that project still have definitions like <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />, <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> in its project file.

So some peroperties, definitions about MSVC will still be imported during build process. That's why the error message you got contains MSVC...

Note:

  1. MSbuild is the build engine of VS, it reads the content of xx.vcxproj to compile and build the project.

  2. There're many tasks, properties, Items for normal C++ build process are defined in imported targets files like Microsoft.Cpp.Default.props,$(VCTargetsPath)\Microsoft.Cpp.targets and so on.

  3. When we right-click project=>Intel Compiler=>Use Intel C++ , it changed the platformToolSet setting, but it still import the xx.cpp.targets as part of build process. So you can see error message about MSVC or what in build output.

LoLance
  • 25,666
  • 1
  • 39
  • 73