在为 iOS 项目编译我的 C++ 时,一切正常。但是,我在 Android 上遇到了困难。
我的 Application.mk 内容如下:
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-11
APP_STL := stlport_shared
所有 LOCAL_SRC_FILES 都已定义。
当我尝试构建我的模块时,我收到以下编译器错误:
jni/Game.hpp: In member function 'const std::pair<pos, Obj*>* MyEnumerator::next()':
jni/Game.hpp:126:23: error: expected type-specifier
jni/Game.hpp:126:23: error: cannot convert 'int*' to 'std::pair<pos, Obj*>*' in assignment
jni/Game.hpp:126:23: error: expected ';'
上面提到的代码行是:
this->ptr = new pair<pos, Obj*>::pair(it->first, it->second);
在这里,ptr
是类型pair<pos, Obj*>*
并且pos
是结构。我已经声明了using std::pair;
。
关于什么是错误的以及尝试什么的任何提示?