0

我有一个非常简单的例子

#include <iostream>
int main() {
    std::cout << "Hello World!" << std::endl;
    return 0;
}

如果我在 Visual Studio Community 2019 上使用 Visual Studio Compiler 编译它,那么它会按预期工作。

但是,当我将编译器更改为与 Intel Parallel Studio 2019 一起安装的 Intel C++ 时,它返回错误

1>------ Build started: Project: Project1, Configuration: Debug x64 ------
1>Source.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(92): error : expected an identifier
1>          !_Is_implicitly_default_constructible<_Uty1>::value || !_Is_implicitly_default_constructible<_Uty2>::value)
1>          ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(91): error : not a valid member class or function template declaration
1>      constexpr explicit(
1>      ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(91): error : "explicit" is not allowed
1>      constexpr explicit(
1>      ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(93): error : expected a ";"
1>          pair() noexcept(
1>          ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(175): error : expected an identifier
1>      constexpr explicit(!is_convertible<const _Other1&, _Ty1>::value // TRANSITION, VSO#946746
1>                         ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(175): error : not a valid member class or function template declaration
1>      constexpr explicit(!is_convertible<const _Other1&, _Ty1>::value // TRANSITION, VSO#946746
1>      ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(175): error : "explicit" is not allowed
1>      constexpr explicit(!is_convertible<const _Other1&, _Ty1>::value // TRANSITION, VSO#946746
1>      ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(177): error : expected a ";"
1>          pair(const pair<_Other1, _Other2>& _Right) noexcept(is_nothrow_constructible_v<_Ty1, const _Other1&>&&
1>          ^
1>
1>compilation aborted for Source.cpp (code 2)
1>Done building project "Project1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

如果我注释掉#include <iostream>and std::cout ~~,它基本上是一个空程序,那么它编译成功并且运行没有错误。

我的系统是

操作系统:64 位 Windows 10 企业版

CPU:AMD锐龙Threadripper 3970X

4

1 回答 1

0

我有一个类似的编译错误:

c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\concepts(47): error : expected ';', near '{'

如果我禁用“bullseye coverage 8.9.44”(与 VS 2015 兼容),我的 prog 编译成功。

于 2021-02-12T11:33:29.760 回答