本文介绍了如何编译C ++ 11 code与Android NDK和eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我采用了android NDK r8d和​​Eclipse朱诺。我试图编译C ++ code,它使用C ++ 11的东西,如互斥 lock_guard 的shared_ptr 等在Eclipse原生的Andr​​oid项目。

I'm using android NDK r8d, and eclipse Juno. I'm trying to compile C++ code which uses C++11 stuff like mutex, lock_guard, shared_ptr, etc. in a native android project in eclipse.

我得到这样的错误:

错误:'shared_ptr的'不是'性病'中的一员

致命的错误:互斥:没有这样的文件或目录

"fatal error: mutex: No such file or directory"

我碰到一个类似的问题here.这似乎为他们工作,但解释没有完成,所以我不能让它为我工作。

I came across a similar question here. It seems to work for them, but the explanation there is not complete so I can't get it to work for me.

我添加NDK_TOOLCHAIN​​_VERSION = 4.7 Application.mk LOCAL_CFLAGS + = -std = C ++ 11 Android.mk 文件。不过,它不会编译。

I added "NDK_TOOLCHAIN_VERSION=4.7" to the Application.mk and "LOCAL_CFLAGS += -std=c++11" to Android.mk file. Still, it doesn't compile.

在它上面的链接说:

一定标准库包含路径(如
  /android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.7/include)是在
  目标设置。

如何以及我在哪里插入呢?

How and where do I insert it?

我也得在Eclipse IDE中的错误(来源上,在编译之前)。我知道我应该定义__ __ GXX_EXPERIMENTAL_CXX0X来解决这些问题,但我只是不知道在哪里把它。

I also get errors in eclipse IDE (on the source, before compiling). I know I should define "__GXX_EXPERIMENTAL_CXX0X__" to resolve them but I just don't know where to put it.

所以,如果有人能与如何编译并与C ++ 11日食工作的充分解释后一个答案将是巨大的。

So, if someone could post an answer with a full explanation of how to compile and make eclipse work with C++11 it would be great.

推荐答案

关于你的第一个问题:


  1. 转到项目>属性> C / C ++通用/路径和符号

  1. Go to Project > Properties > C/C++ General / Paths and Symbols

在包含选项卡,添加适当的目录,例如
/ Android的NDK-r8d /来源/ CXX-STL / GNU-的libstdc ++ / 4.7 /包括

In the "Includes" tab, add the proper directory, e.g./android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.7/include

关于你提到的第二个问题,我也在寻找一个答案。这是绝对不明确如何定义的 GXX_EXPERIMENTAL_CXX0X 在Eclipse中宏。

Regarding your second question, I'm also looking for an answer. It is absolutely not clear how to define the GXX_EXPERIMENTAL_CXX0X macro in Eclipse.

有人说,它应该是添加为predefined宏索引,但它看起来像我们都无法找到一个方法来实现这...

Some say that it should be "added as a predefined macro to the indexer", but it looks like we both could not find a way to implement that...

我看过其他地方,它应该被添加到C / C ++通用/路径和符号/符号/ GNU C ++,但我不能找到符号/ GNU C ++的一部分在我的版本靛蓝的。

I have read elsewhere that it should be added to "C/C++ General / Paths and Symbols / Symbols / GNU C++" but I can't find the "Symbols / GNU C++" part in my version of Indigo.

这篇关于如何编译C ++ 11 code与Android NDK和eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:44