【问题标题】:Std in ndk with cpp - vector problems带有 cpp 的 ndk 中的 Std - 向量问题
【发布时间】:2012-07-03 13:23:53
【问题描述】:

我正在尝试为 ndk 编译一个大型 c++ 代码。

我收到一堆错误。其中很多与向量有关:

  • vector<int> myvector --> '<' 给出错误
  • ::iterator 不能声明

关于如何获得完整的 STL 支持的任何想法?我用了很多库,比如vector、algorithm、iostream等

这是我的 Android.mk 文件

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := native
LOCAL_SRC_FILES := vns.cpp note.cpp cscore.cpp hscorecf.cpp hscorecp.cpp scoreinfo.cpp cscore.cpp score.cpp randMusic.cpp input.cpp main.cpp

APP_STL := stlport_shared
#but I have tried system, stlport_static, stlport_shared, or gnustl_static.
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

知道了。

我需要将 APP_STL := stlport_shared 放在单独的 Application.mk 文件中!

【问题讨论】:

  • 你试过std::vector<int> myvector(用std::)。

标签: c++ stl vector android-ndk


【解决方案1】:

知道了。我需要将 APP_STL := stlport_shared 放在单独的 Application.mk 文件中。

【讨论】:

    【解决方案2】:

    好像你忘了#include <vector> 标头或using namespace std;

    【讨论】:

    • using namespace std 通常是个坏主意。
    • 知道了。我需要将 APP_STL := stlport_shared 放在单独的 Application.mk 文件中。
    猜你喜欢
    • 2021-10-27
    • 2012-07-14
    • 2016-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-23
    • 2014-01-18
    • 1970-01-01
    相关资源
    最近更新 更多