Intel Compiler uses wrong header

╄→尐↘猪︶ㄣ 提交于 2019-12-11 13:01:20

问题


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?


回答1:


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:

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.




回答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.



来源:https://stackoverflow.com/questions/58279256/intel-compiler-uses-wrong-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!