【发布时间】:2015-08-28 09:15:43
【问题描述】:
我正在使用 android NDK 独立工具链编译 Qt/C++ 项目。我使用 make-standalone-toolchain.sh --arch=arm --toolchain=arm-linux-androideabi-4.9 --platform=android-21 命令创建了独立工具链。 NDK 版本是 android-ndk-r10e。目标项目使用 pthread 库中的一些函数。在编译时,我收到以下错误:
error: 'pthread_getaffinity_np' was not declared in this scope
const int err = pthread_getaffinity_np(_pthreadId, sizeof(cpu_set_t), &cpuSetMask);
compilation terminated due to -Wfatal-errors.
我检查了ndk工具链中包含的pthread的头文件,我没有找到pthread_getaffinity_np函数的声明。
Android 的 pthread 功能是否受限?如何在 Android NDK 中正确使用 pthread?
【问题讨论】:
-
@deltheil 说的是真的。我的解决方案是我不使用 pthread 功能。我通过条件编译达到了这一点,因为在 Android 系统上我无论如何都不使用线程功能。
标签: android c++ qt android-ndk pthreads