Android NDK报错(Eclipse)及解决方法
2016-05-06 09:27
429 查看
在AndroidNDK开发过程中,工程目录下的jni文件夹下编写的c/c++代码,通常会出现如下的几种类型的报错:
1、Unresolved inclusion:<XXX>
2、syntax error
3、Function 'XXX' could not be resolved
4、Type 'XXX' could not be resolved
5、Symbol 'XXX' could not be resolved
6、Method 'XXX' could not be resolved
7、Invalid arguments 'Candidates are: ...'
1 错误形式一:没有导入头文件(这是最大的错误,会引起一系列下面的报错)。通常会有如下表现形式:
1、Unresolved inclusion: <jni.h>、Unresolved inclusion: <stdio.h>、Unresolved inclusion: <malloc.h>、Unresolved inclusion: <Android/log.h>、...
2、Function '__android_log_print' could not be resolved、Type 'JNIEnv' could not be resolved、Type 'jstring' could not be resolved、Type 'jclass' could not be resolved、Function 'malloc' could not be resolved、Function 'memcpy' could not be resolved、Method
'FindClass' could not be resolved、Type 'jsize' could not be resolved、Symbol 'NULL' could not be resolved、...
解决方法:右击项目 --> Properties --> 左侧C/C++ General --> Paths and Symbols --> 右侧Includes --> GNU C++(.cpp) --> Add——>${NDKROOT}\platforms\android-18\arch-arm\usr\include(tips:这里的NDK platforms\android-18一定要和你的工程的properties里的target一致)。
2 错误形式二:
1、Unresolved inclusion: <iostream>、Unresolved inclusion: <fstream>、Symbol 'std' could not be resolved、..
2、Type 'fstream' could not be resolved、Symbol 'in' could not be resolved、Method 'seekg' could not be resolved、Method 'read' could not be resolved、...
解决方法: 添加路径(步骤见上述解决方法):${NDKROOT}\sources\cxx-stl\gnu-libstdc++\4.8\include 、${NDKROOT}\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi\include。
3 错误形式三: Invalid arguments 'Candidates are:void * malloc(?)'、Invalid arguments 'Candidates are:void * memcpy(void *, const void *, ?)'
解决方法: 添加路径(步骤见上述解决方法):${NDKROOT}\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.8\include
解决了错误,大家have fun
1、Unresolved inclusion:<XXX>
2、syntax error
3、Function 'XXX' could not be resolved
4、Type 'XXX' could not be resolved
5、Symbol 'XXX' could not be resolved
6、Method 'XXX' could not be resolved
7、Invalid arguments 'Candidates are: ...'
1 错误形式一:没有导入头文件(这是最大的错误,会引起一系列下面的报错)。通常会有如下表现形式:
1、Unresolved inclusion: <jni.h>、Unresolved inclusion: <stdio.h>、Unresolved inclusion: <malloc.h>、Unresolved inclusion: <Android/log.h>、...
2、Function '__android_log_print' could not be resolved、Type 'JNIEnv' could not be resolved、Type 'jstring' could not be resolved、Type 'jclass' could not be resolved、Function 'malloc' could not be resolved、Function 'memcpy' could not be resolved、Method
'FindClass' could not be resolved、Type 'jsize' could not be resolved、Symbol 'NULL' could not be resolved、...
解决方法:右击项目 --> Properties --> 左侧C/C++ General --> Paths and Symbols --> 右侧Includes --> GNU C++(.cpp) --> Add——>${NDKROOT}\platforms\android-18\arch-arm\usr\include(tips:这里的NDK platforms\android-18一定要和你的工程的properties里的target一致)。
2 错误形式二:
1、Unresolved inclusion: <iostream>、Unresolved inclusion: <fstream>、Symbol 'std' could not be resolved、..
2、Type 'fstream' could not be resolved、Symbol 'in' could not be resolved、Method 'seekg' could not be resolved、Method 'read' could not be resolved、...
解决方法: 添加路径(步骤见上述解决方法):${NDKROOT}\sources\cxx-stl\gnu-libstdc++\4.8\include 、${NDKROOT}\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi\include。
3 错误形式三: Invalid arguments 'Candidates are:void * malloc(?)'、Invalid arguments 'Candidates are:void * memcpy(void *, const void *, ?)'
解决方法: 添加路径(步骤见上述解决方法):${NDKROOT}\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.8\include
解决了错误,大家have fun
相关文章推荐
- ssh hibernate struts spring 工作原理及为什么要用
- float转16进制, 16进制转float(java )
- Eclipse批量修改包名
- spring boot 连接池配置
- 使用spring web.xml里的配置 - 请求处理器DispatcherServlet
- struts 拦截器设置防止表单的重复提交
- 【行为型模式】模板方法模式(template method)之23种java设计模式
- 《java入门第一季》之面向对象(重头戏多态)
- 《java入门第一季》之面向对象(重头戏多态)
- 怎样判读安装java jvm是32位还是64位的
- POI操作EXCEL03和EXCEL07以上版本
- Set、Map集合
- Eclipse安装Genymotion插件问题
- java中怎么在获取的系统时间上提前一周一月一年或推迟一周,一月或者一年
- Java中ArrayList类的用法与源码完全解析
- Java用于校验一个字符串是否是合法的JSON格式
- Spring之AOP
- java线程——synchronized的4种用法
- 【java设计模式】之 模板方法(Template Method)模式
- 69个Spring面试题