前提・実現したいこと
C++AMPでプログラムを作成するために、まずはHelloWorldをやろうかと取り組んでいます。
MSブログからコードを引用しています。
発生している問題・エラーメッセージ
コンパイルしようとすると以下のメッセージが出ます。
1>~\msvc\14.14.26428\include\amp.h(2616): error C3861: '_Access': 識別子が見つかりませんでした 1>~\msvc\14.14.26428\include\amp.h(2618): note: クラス テンプレート のメンバー関数 'int &Concurrency::array_view<int,1>::operator ()(const Concurrency::index<1> &) restrict(amp) const' のコンパイル中 1>~\msvc\14.14.26428\include\amp.h(2602): note: コンパイル対象の関数 テンプレート インスタンス化 'int &Concurrency::array_view<int,1>::operator ()(const Concurrency::index<1> &) restrict(amp) const' のリファレンスを確認してください 1>~\sample.cpp(9): note: コンパイル対象の クラス テンプレート インスタンス化 'Concurrency::array_view<int,1>' のリファレンスを確認してください 1>~\msvc\14.14.26428\include\amp.h(2616): error C3588: 'unknown-type' から 'void *' へのキャストは amp 制限コードでサポートされていません
該当のソースコード
MSブログのコードを引用しています。
C++
1#include <iostream> 2#include <amp.h> 3using namespace concurrency; 4int main() 5{ 6 int v[11] = { 'G', 'd', 'k', 'k', 'n', 31, 'v', 'n', 'q', 'k', 'c' }; 7 8 array_view<int> av(11, v); 9 parallel_for_each(av.extent, [=](index<1> idx) restrict(amp) 10 { 11 av[idx] += 1; 12 }); 13 14 for (unsigned int i = 0; i < 11; i++) 15 std::cout << static_cast<char>(av[i]); 16}
試したこと
av[idx] += 1;
の部分をav[idx]
にしてもコンパイルが通らないので、ここでキャスト(なぜキャストしてるのかもよくわからないですが)がうまくいっていないものだと思います。
補足情報(FW/ツールのバージョンなど)
Visual Studio 2017 ver15.7.5

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/28 04:58
2018/07/28 05:14
2018/07/28 05:18
2018/07/28 05:24
2018/07/28 05:32