建立C ++ 11(的std ::线程)的NDK与ADT / Eclipse中 [英] Setting up C++11 (std::thread) for NDK with ADT/Eclipse

查看:418
本文介绍了建立C ++ 11(的std ::线程)的NDK与ADT / Eclipse中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用C ++ 11。我开发一个Android项目,我想使用std ::互斥。随着OpenCV的 但无论我做什么,我只是不能似乎解决了键入互斥无法解析 错误。

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 <一href="http://stackoverflow.com/questions/8763937/c0x-compiles-but-eclipse-editor-errors-even-with-gnu0x-discovery">LINK2 LINK3 <一href="http://stackoverflow.com/questions/8312854/eclipse-indexer-cant-resolve-shared-ptr">LINK4

I have tried following the tutorials i found on SO and other places. LINK1 LINK2 LINK3LINK4

  1. ADT v22.3.0-887826
  2. 在安装的C / C ++编译器(CDT)

随着这么多的教程,它已经成为一个真正的混乱了。因此,我将解释我的当前设置

Following so many tutorials, it has become a real mess now. So I will explain my current settings

  • 项目>属性> C / C ++编译>工具链编辑器
    • 在当前工具链是跨海湾合作委员会
    • 在当前Builder是机器人生成器
    • Project > Properties > C/C++ Build > Tool Chain Editor
      • Current Tool Chain is "Cross GCC"
      • Current Builder is "Android Builder"

      项目>属性> C / C ++编译>搜索选项

      Project > Properties > C/C++ Build > Discovery Options

      • 在编译器调用命令是海湾合作委员会
      • Compilter调用argments是-E -P -v -dD$ {plugin_state_location} /specs.c -std = C + + 11

      项目> C / C ++常规>路径和符号>#符号标签

      Project > C/C++ General > Paths and Symbols > # Symbols tab

      • 符号= __cplusplus和值= 1

      在我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 带一个空值

      I tried to change the cplusplus symbol's value to 201103L and tried __GXX_EXPERIMENTAL_CXX0X with an empty value

      但似乎没有任何工作,我在做什么错了?

      But nothing seems to work, What am I doing wrong??

      任何帮助是AP preciated!

      Any help is appreciated!

      推荐答案

      支持的std ::线程是一个有点特殊。的问题得到解决,例如,在本文通过并拢。这篇文章是非常短的,但它可以用一句话概括:

      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:

      您无法使用(默认),GCC 4.6工具链,如果你想的#include&LT;螺纹&GT; 的#include&LT;互斥&GT;

      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 =铛应用程序。 MK

      有关ADT重建其的首页的正确,看的 <一个href="http://stackoverflow.com/questions/23155676/android-ndk-build-method-could-not-be-resolved">Android NDK构建,方法无法得到解决 <一个href="http://stackoverflow.com/questions/16786555/eclipse-compiles-successfully-but-still-gives-semantic-errors">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.

      这篇关于建立C ++ 11(的std ::线程)的NDK与ADT / Eclipse中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆