我一直在尝试使用 C++11.我正在开发一个 android 项目,我想使用 std::mutex.与 OpenCV 一起但无论我做什么,我似乎都无法修复 Type 'mutex' could not be resolved错误.
I have been trying to use C++11. I am developing an android project and i want to use std::mutex. Along with OpenCV
But no matter what I do, I just cant seem to fix the Type 'mutex' could not be resolved
error.
我尝试按照我在 SO 和其他地方找到的教程进行操作.LINK1 LINK2 LINK3LINK4
I have tried following the tutorials i found on SO and other places. LINK1 LINK2 LINK3LINK4
看了这么多教程,现在变得一团糟.所以我将解释我当前的设置
Following so many tutorials, it has become a real mess now. So I will explain my current settings
项目 > 属性 > C/C++ 构建 > 发现选项
Project > Properties > C/C++ Build > Discovery Options
项目 > C/C++ 常规 > 路径和符号 > # 符号选项卡
Project > C/C++ General > Paths and Symbols > # Symbols tab
在我的 Application.mk 文件中,我有以下内容
In my Application.mk file I have the following
APP_STL := gnustl_static
APP_USE_CPP0X := true
APP_CPPFLAGS := -std=c++11 -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8
我尝试将 cplusplus 符号的值更改为 201103L并用空值尝试了 __GXX_EXPERIMENTAL_CXX0X
但似乎没有任何效果,我做错了什么??
But nothing seems to work, What am I doing wrong??
感谢任何帮助!
对 std::thread 的支持有点特殊.例如,在 这篇文章中解决了这个问题由冰龙.文章确实很短,但一句话就能概括:
Support for std::thread is a bit special. The issue is addressed, for example, in this article by Binglong. The article is really short, but it can be summarized in one sentence:
如果您想 #include <thread> 或 #include <mutex>,则不能使用(默认)gcc 4.6 工具链.
You cannot use the (default) gcc 4.6 toolchain if you want to
#include <thread>or#include <mutex>.
所以,请将 NDK_TOOLCHAIN_VERSION=4.8 或 NDK_TOOLCHAIN_VERSION=clang 添加到您的 Application.mk.
So, please add NDK_TOOLCHAIN_VERSION=4.8 or NDK_TOOLCHAIN_VERSION=clang to your Application.mk.
要让 ADT 正确重建其 Index,请参阅 Android NDK 构建,方法无法解析 或 Eclipse 编译成功但仍然给出语义错误.
For ADT to rebuild its Index correctly, see Android NDK build, Method could not be resolved or Eclipse compiles successfully but still gives semantic errors.
这篇关于使用 ADT/Eclipse 为 NDK 设置 C++11 (std::thread)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
上传进度侦听器未触发(Google 驱动器 API)Upload progress listener not fired (Google drive API)(上传进度侦听器未触发(Google 驱动器 API))
使用 Google Drive SDK 将文件保存在特定文件夹中Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 将文件保存在特定文件夹中)
Google Drive Android API - 无效的 DriveId 和 Null ResourcGoogle Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 无效的 DriveId 和 Null ResourceId)
检查上传和进度下载(适用于 Android 或 Java 的 GoCheck progress for Upload amp; Download (Google Drive API for Android or Java)(检查上传和进度下载(适用于 Android 或 Java 的 Google Drive
在 Android 上获取所有文件夹 google drive apiGet all folders google drive api on Android(在 Android 上获取所有文件夹 google drive api)
Android - 谷歌电子表格 APIAndroid - Google Spreadsheet Api(Android - 谷歌电子表格 API)