当我为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;
。有什么提示可以说明问题出在哪里,应该尝试什么?