visual-studiomsbuildvisual-studio-2017iccintel-composer

Intel Compiler uses wrong header


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?


Solution

  • 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.