JNI错误之:error: base operand of '->' has non-pointer type '_JNIEnv'
来源:互联网 发布:卓越工具箱淘宝客软件 编辑:程序博客网 时间:2024/06/13 19:06
参考:http://hepeng421.blog.163.com/blog/static/11948517201402344215411/
写这个代码时报错:pEnv->NewStringUTF(),
仔细一看原来是:因为c和c++对JNIEnv的定义是不同的,从jni.h下面代码看得出来
这么来解决问题:
1》使用c++来写代码,文件名就必须【cpp】后缀:
C++ code must have .cpp extension.,必须cpp后缀,c后缀不行;
2》使用c来写代码,文件名就必须【c】后缀;
2》调用的代码这么来写:
//return (*env)->NewStringUTF(env, "Hello from JNI !");//如果是用C语言格式就用这种方式
//return env->NewStringUTF((char *)"Hello from JNI !");//C++用这种格式
//return env->NewStringUTF((char *)"Hello from JNI !");//C++用这种格式
阅读全文
0 0
- JNI错误之:error: base operand of '->' has non-pointer type '_JNIEnv'
- (Android jni) error: base operand of '->' has non-pointer type '_JNIEnv'
- 安卓JNI编程-- :error: base operand of '->' has non-pointer type '_JNIEnv' 解决办法
- JNI: error: base operand of ‘->’ has non-pointer type ‘JNIEnv’
- base operand of '->' has non-pointer type 'JNIEnv {aka _JNIEnv}'和Method 'GetStringUTFChars' could no
- base operand of '->' has non-pointer type 'JNIEnv {aka _JNIEnv}'和Method 'GetStringUTFChars' could no
- error: base operand of ‘->’ has non-pointer type ‘JNIEnv’
- [Error] base operand of '->' has non-pointer type 'stac
- C++ : 出错解释 base operand of '->' has non-pointer type 'std::pair<int, int>'
- Android将“.c”后缀名改成“.cpp”时java调用native失败及“error: base operand of '->' has non-poin
- 编译错误:error: invalid initialization of non-const reference of type ‘*&’ from a temporary of type
- 错误1error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::str
- 解决 C++错误 error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no
- error: ‘asm’ operand has impossible constraints
- error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::wstring'
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string'
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string'
- Spring参数校验
- 多渠道打包方法简介
- 处理Gradle中的这个文件下载慢的问题
- 4用于cifar10的卷积神经网络-4.20relu, relu6和softplus激活函数的输出汇总分析
- 1. Hello Go(Go Tutorial)
- JNI错误之:error: base operand of '->' has non-pointer type '_JNIEnv'
- table 和 pivot_table
- 浅析大端小端
- 【Scikit-Learn 中文文档】十九:高斯混合模型
- qml:c++与qml同时需要实现国际化
- linux用cat命令进入一个很大的文件,如何退出?
- VMware Workstation虚拟机 12.5.7安装
- HDU2012
- 111. Minimum Depth of Binary Tree