Я пытаюсь скомпилировать некоторые из моих старых приложений, и он не компилируется там, где они сталкиваются с лямбдами. Я хорошо знаю, что этот 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