【问题标题】:Android NDK Eclipse CDT won't allow me to use substr method of stringAndroid NDK Eclipse CDT 不允许我使用字符串的 substr 方法
【发布时间】:2013-08-04 06:46:26
【问题描述】:

即使是这样的简单代码也会出现错误

string test= "hello";
string part = test.substr(2, 3);

无效参数候选者是:stlpmtx_std::basic_string,stlpmtx_std::allocator> substr(?, ?)

即使转换为 size_t 也无济于事 字符串部分 = test.substr((size_t)2, (size_t)3);

但是,当在 Linux 上使用 gcc 4.6 作为控制台应用程序运行时,这两条代码都可以正常工作。 但是当使用 Androind NDK 时,它给了我错误。

如果我在编辑器中关闭文件并关闭 Eclipse,然后打开 Eclipse 并构建它编译的项目。但是如果我打开文件,它会抛出错误。

我在 Application.mk 生成文件中使用 APP_STL:= stlport_static

是的,我确实包含了

编辑:我只是查看了 .so 文件的时间,即使 Eclipse 显示错误,它似乎也在编译。

【问题讨论】:

  • 您是否包含<string>
  • 是的,我确实包括了那个

标签: android c++ android-ndk substring eclipse-cdt


【解决方案1】:

我找到了解决方案,我需要在项目属性的路径和符号部分中包含 stlport 系统包含文件夹 -> C/C++ 常规

path_To_NDK/sources/cxx-stl/system/include

我只有一个

 path_To_NDK/sources/cxx-stl/stlport/stlport

【讨论】:

  • 使用 ADT 包处理混合 Android 项目要容易得多。例如,它会为您自动发现包含路径。
  • 我确定我已经安装了 ADT 包
  • 最新版本的 ADT 不会为 Android NDK 工具链公开“路径和符号”。
  • 我不会更新 ADT 并破坏一些东西,所以如果他们不公开它,Eclipse 怎么知道在哪里找到它
猜你喜欢
  • 1970-01-01
  • 2015-07-17
  • 1970-01-01
  • 1970-01-01
  • 2012-03-11
  • 2021-05-13
  • 2023-03-19
  • 2012-01-30
  • 2017-03-04
相关资源
最近更新 更多