【发布时间】:2014-01-18 03:00:53
【问题描述】:
我已经阅读了所有其他涉及 STL 库和带有 Eclipse 的 Android NDK 的帖子,但我的 JNI 文件中仍然存在这个问题:
#include <vector>
std::vector<std::string> test;
test.push_back("hello");
std::vector<std::string>::size_type h = 0;
unsigned int t = 0;
std::string blah = test.at(h);
std::string hell = test.at(t);
at() 是两个实例中突出显示的语法,并带有以下错误消息:
Invalid arguments '
Candidates are:
stlpmtx_std::basic_string<char,stlpmtx_std::char_traits<char>,stlpmtx_std::allocator<char>> & at(?)
const stlpmtx_std::basic_string<char,stlpmtx_std::char_traits<char>,stlpmtx_std::allocator<char>> & at(?)
'
没有突出显示其他内容。图书馆建设良好。使用内置数据类型的结果相同,例如 vector<int>。
与:
int h = 0;
memcpy(ar, res, h);
我用以下消息突出显示 memcpy:
Invalid arguments '
Candidates are:
void * memcpy(void *, const void *, ?)
'
这是 Application.mk:
APP_ABI := armeabi-v7a armeabi
APP_OPTIM := release
APP_STL := stlport_static
和 Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# *** Remember: Change -O0 into -O2 in add-applications.mk ***
LOCAL_MODULE := soundtouch
LOCAL_SRC_FILES := soundtouch-jni.cpp soundtouch/source/SoundTouch/AAFilter.cpp soundtouch/source/SoundTouch/FIFOSampleBuffer.cpp \
soundtouch/source/SoundTouch/FIRFilter.cpp soundtouch/source/SoundTouch/cpu_detect_x86.cpp \
soundtouch/source/SoundTouch/RateTransposer.cpp soundtouch/source/SoundTouch/SoundTouch.cpp \
soundtouch/source/SoundTouch/TDStretch.cpp soundtouch/source/SoundTouch/BPMDetect.cpp soundtouch/source/SoundTouch/PeakFinder.cpp
# for native audio
LOCAL_LDLIBS += -lgcc
LOCAL_C_INCLUDES += $(LOCAL_PATH)/soundtouch/include
# --whole-archive -lgcc
# for logging
LOCAL_LDLIBS += -llog
# for native asset manager
#LOCAL_LDLIBS += -landroid
# don't export all symbols
# added "-marm" switch to use arm instruction set instead of thumb for improved calculation performance.
LOCAL_CFLAGS += -Wall -fvisibility=hidden -I soundtouch/source/../include -D ST_NO_EXCEPTION_HANDLING -fdata-sections -ffunction-sections -marm
include $(BUILD_SHARED_LIBRARY)
我的 C++ 常规 - 路径和符号 包括:
D:\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\include
D:\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi-v7a\include
D:\android-ndk-r9c\platforms\android-8\arch-arm\usr\include
为了语法高亮,我怎样才能让这些正确的语句不产生错误?
【问题讨论】:
标签: c++ stl android-ndk eclipse-cdt