Android的NDK源代码编译和放大器;构建成功 - 但功能“to_string”无法在Eclipse IDE中得到解决 [英] Android NDK Source Compiled & Build Successfully - But Function 'to_string' could not be resolved in Eclipse IDE

查看:250
本文介绍了Android的NDK源代码编译和放大器;构建成功 - 但功能“to_string”无法在Eclipse IDE中得到解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了如何使用to_string()购买Android NDK。经过长时间的搜寻后,从该<一个href=\"http://stackoverflow.com/questions/22774009/android-ndk-stdto-string-support/27563132#27563132\">link,因为说我改变了Application.mk文件。和自备电厂的源代码编译,只有从终端正确地构建。

I searched how to use to_string() in android ndk. After a long search, from this link, i changed the Application.mk file as said. And the cpp source compiled and build properly only from the terminal.

        Terminal output :
         > ndk-build
        Android NDK: WARNING: APP_PLATFORM android-21 is larger than android:minSdkVersion 9 in        
/<some path>/Android/Exercise01/AndroidManifest.xml    
    [armeabi-v7a] Install        : libndkfoo.so => libs/armeabi/libndkfoo.so

但在ecplise IDE,还是我得到错误的功能to_string无法解析。因此,从IDE我不能够运行Android应用程序。 (注:性病:: to_string的使用前,源正确的编译)

我试图包含头文件如下(根据项目属性 - > C / C ++常规 - >路径和Symbols-> GNU C ++)

I tried to include the header files as below (under project properties->C/C++ general->Path and Symbols->GNU C++)

从//android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/ext结果vstring.h
&安培;结果
从//android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/bits basic_string.h

vstring.h from //android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/ext
&
basic_string.h from //android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/bits

但没有运气。

Androi.mk文件

Androi.mk File

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS    := -llog
TARGET_PLATFORM := android-21
TARGET_ARCH_ABI := armeabi-v7a
TARGET_ABI := android-21-armeabi-v7a # concatenation of above two variables
# Here we give our module name and source file(s)
LOCAL_MODULE    := ndkfoo
LOCAL_C_INCLUDES := $(LOCAL_PATH)/header
LOCAL_SRC_FILES := src/NativeFunction.cpp src/clsArithmeticParser.cpp
include $(BUILD_SHARED_LIBRARY)

Application.mk

Application.mk

#APP_STL := stlport_static
APP_STL:=c++_static       

我知道,我做了一些小的失误,但没能找到很长一段时间。任何解决方案/建议AP preciated。

I know, i am doing some small mistake, but not able to find for a long time. Any solution/suggestion appreciated.

编辑:结果
我能够使用的std :: to_string&安培;的std ::斯托尔通过仅低于招蚀。这些可以帮助一些之一罕见的情况。因此,增加这点来测试C ++通过Eclipse IDE的11支持。所示的误差只有当源文件或标题文件打开。只是关闭打开的源文件的文件(.H,.C,.cpp)文件。关闭并重新打开蚀。现在,它已准备好编译并通过Android模拟器中运行。

Edited :
I am able use the std::to_string & std::stoll through eclipse in the below trick only. These can help some one in rare situation. So adding this point to test the c++11 support through eclipse IDE. The error shown only when the source file or the header file opened. Just close open source file documents (.h, .c, .cpp). Close and reopen the eclipse. Now it is ready to compile and run through the android emulator.

推荐答案

由@Khaled Lakehal,我指自己的答案张贴这个答案我question.Hope这可能帮助别人之后。

After referring the answer by @Khaled Lakehal, I myself posting this answer for my question.Hope this may help someone.

沿袭了下面的步骤,使其工作:

Followed the below step to make it work:


  1. 更新从月神Eclipse版本为最新的火星2

  2. 导入现有的项目从旧版本的eclipse
    使用 - >导入 - >现有的Andr​​oid code到工作区

  3. 有一些问题,与C / C ++项目导入后的转换。因此,遵循了这一<一个href=\"http://stackoverflow.com/questions/11504258/how-to-remove-native-support-from-an-android-project-in-eclipse-because-eclipse/23804805#23804805\">link撤消C / C ++项目转换

  4. 转换项目以C / C ++新。

  5. 要删除错误,我提到这个<一个href=\"http://stackoverflow.com/questions/16786555/eclipse-compiles-successfully-but-still-gives-semantic-errors/16891713#16891713\">link,并选择了与构建运行

  6. 关闭和放大器;重新打开IDE

  1. Update the eclipse version from Luna to latest Mars 2
  2. Imported the existing project from the old version of the eclipse using -> import -> Existing Android code into Workspace
  3. Had some problem with the C/C++ project conversion after import. So followed this link to undo the C/C++ project conversion
  4. Converted the project to C/C++ newly.
  5. To remove the error, I referred this link, and selected the "Run with build" only
  6. Close & Reopen the IDE

所以,现在能够使用的std :: to_string&安培;的std ::斯托尔功能。

So now able to use the std::to_string & std::stoll functions.

这篇关于Android的NDK源代码编译和放大器;构建成功 - 但功能“to_string”无法在Eclipse IDE中得到解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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