Android NDK'de eşzamansız programlamanın çalışıp çalışmadığını öğrenmek için aşağıdaki örnek kodu çalıştırmayı denedim. NDK, bir üstbilgi olarak tanınan STL <future>
'a sahip olsa da, std::async
tanınmıyor algılanmıyor.C++ 11 std :: async Android'de NDK çalışmıyor
#include <future>
#include <iostream>
struct Foo
{
Foo() : data(0) {}
void sum(int i) { data +=i;}
int data;
};
int main()
{
Foo foo;
auto f = std::async(&Foo::sum, &foo, 42);
f.get();
std::cout << foo.data << "\n";
}
Ayrıca tüm yolları
Errors
Description Resource Path Location Type
invalid use of incomplete type 'std::__async_sfinae_helper<void (Foo::*)(int), void (Foo::*)(int), Foo*, int>::type {aka struct std::future<void>}' Sample.cpp /Project12/jni line 50 C/C++ Problem
Description Resource Path Location Type
declaration of 'std::__async_sfinae_helper<void (Foo::*)(int), void (Foo::*)(int), Foo*, int>::type {aka struct std::future<void>}' Project12 line 111, external location: D:\android-ndk-r8e-windows-x86_64\android-ndk-r8e\sources\cxx-stl\gnu-libstdc++\4.6\include\future C/C++ Problem
bunu almıyorum ... Aslında ben bile kullanmak mümkün değilim enum içinde tanımlanmıştır .... Eclipse veya ndk veya ı bilmiyorum kütüphane ile ilgili bir sorun var –
user2508941
Bu NDK ile sorun. Sadece güncellemeyi bekle. Clang 3.3 ve yeni stdlib bir gün orada olacak. –
@ user2508941 NDK r9 dışarı çıktı, clang 3.3 ile. – Samveen