gpt4 book ai didi

c++ - 为什么不编译? (VC++ 2015,#pragma omp flush)

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:16:03 26 4
gpt4 key购买 nike

这是一个最小的例子。在 Visual C++ 2015 上使用“/openmp”编译。

#include <vector>
void main()
{
bool foo = false;
#pragma omp flush (foo)
std::vector<int> bar;
}

我得到:

C2146   syntax error : missing ';' before identifier 'bar'
C2275 'std::vector<int,std::allocator<_Ty>>' : illegal use of this type as an expression
C2065 'bar' : undeclared identifier

如果我注释掉 #pragma,错误就会消失。

如果我将 std::vector 替换为 int,错误就会消失。

如果我将 ; 单独放在一行中 #pragma 下方,错误就会消失。

最佳答案

“为什么这不能编译?”问题的简明回答。是“这是一个编译器错误”。错误报告在: https://connect.microsoft.com/VisualStudio/feedbackdetail/view/2420614已被关闭为“已修复”......“此项目已在此产品的当前或即将发布的版本 [Visual Studio 2015] 中修复”。

关于c++ - 为什么不编译? (VC++ 2015,#pragma omp flush),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35568653/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com