【问题标题】:unable to use c++amp in vs 2017无法在 vs 2017 中使用 c++amp
【发布时间】:2017-03-21 06:06:41
【问题描述】:

我尝试在 Visual Studio 2017 中使用 C++ amp,但编译器说“错误 C3564”,我尝试了旧代码(在 Visual Studio 2015 中工作),它说同样的话。 Visual Studio 2017 是否支持 C++ amp?

#include "stdafx.h"
using namespace concurrency;
int main(void){
    int size;
    scanf_s("%d", &size);
    array_view<int, 1> a(1);
    parallel_for_each(extent<1>(1),
    [=](index<1> &idx) restrict(amp)
    {
        a(idx) = size;
    });
}

上面的代码会产生问题。

【问题讨论】:

  • 请出示您的代码..
  • @AshwinGolani 我找到了发生错误的部分。

标签: visual-c++ c++-amp


【解决方案1】:

刚刚添加了amp.h文件,上面的代码就编译好了。

我还在 vs 2017 中使用 C++AMP 开发其他项目,并且运行良好。

#include "stdafx.h"
#include <amp.h>

using namespace concurrency;

int main(void) {
    int size;
    scanf_s("%d", &size);
    array_view<int, 1> a(1);
    parallel_for_each(extent<1>(1),
        [=](index<1> &idx) restrict(amp)
    {
        a(idx) = size;
    });
}

【讨论】:

  • 是的,这是 VS 上的一个错误,他们在以后的版本中修复了它。 Link
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-07
  • 1970-01-01
相关资源
最近更新 更多