6
Android NDKで非同期プログラミングが動作しているかどうかを知るために、次のサンプルコードを取得しようとしました。 NDKはヘッダーとして認識されるSTL <future>
を持っていますが、認識されていないstd::async
は認識されません。Android NDKのC++ 11 std :: asyncが動作しない
#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";
}
また、すべてのインクルードは、パスが
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
まだ私はそれを取得しておりません...実際に私も使用することはできませんよ列挙型はで定義されています... Eclipseやndkやライブラリで問題がありますかわからない –
user2508941
NDKの問題です。ちょうど更新を待つ。 Clang 3.3と新しいstdlibはある日そこにいます。 –
@ user2508941 NDK r9が外れていて、clang 3.3です。 – Samveen