Я пытаюсь скомпилировать некоторые из своих старых приложений, но они не компилируются там, где встречаются лямбда-выражения. Я прекрасно понимаю, что этот API устарел, но некоторое время назад он нормально скомпилировался на том же компьютере, в той же VisualStudio 2022.
Я попробовал пример из Microsoft, пример из Microsoft, и он компилируется с той же ошибкой.
#define _SILENCE_AMP_DEPRECATION_WARNINGS
#pragma comment(compiler, "/D:_SILENCE_AMP_DEPRECATION_WARNINGS")
#include
#include
using namespace concurrency;
const int size = 5;
void CppAmpMethod() {
int aCPP[] = {1, 2, 3, 4, 5};
int bCPP[] = {6, 7, 8, 9, 10};
int sumCPP[size];
// Create C++ AMP objects.
array_view a(size, aCPP);
array_view b(size, bCPP);
array_view sum(size, sumCPP);
sum.discard_data();
parallel_for_each(
// Define the compute domain, which is the set of threads that are created.
sum.extent,
// Define the code to run on each thread on the accelerator.
[=](index idx) restrict(amp) {
sum[idx] = a[idx] + b[idx];
}
);
// Print the results. The expected output is "7, 9, 11, 13, 15".
for (int i = 0; i < size; i++) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79778802/amp-deprecated-code-doesnt-compile-with-lambdas[/url]
Я пытаюсь скомпилировать некоторые из своих старых приложений, но они не компилируются там, где встречаются лямбда-выражения. Я прекрасно понимаю, что этот API устарел, но некоторое время назад он нормально скомпилировался на том же компьютере, в той же VisualStudio 2022. Я попробовал пример из Microsoft, пример из Microsoft, и он компилируется с той же ошибкой. [code]#define _SILENCE_AMP_DEPRECATION_WARNINGS #pragma comment(compiler, "/D:_SILENCE_AMP_DEPRECATION_WARNINGS") #include #include using namespace concurrency;
const int size = 5;
void CppAmpMethod() { int aCPP[] = {1, 2, 3, 4, 5}; int bCPP[] = {6, 7, 8, 9, 10}; int sumCPP[size];
parallel_for_each( // Define the compute domain, which is the set of threads that are created. sum.extent, // Define the code to run on each thread on the accelerator. [=](index idx) restrict(amp) { sum[idx] = a[idx] + b[idx]; } );
// Print the results. The expected output is "7, 9, 11, 13, 15". for (int i = 0; i < size; i++) { std::cout