XCode里遇到 #include <XXX.h>file not found的解决方案
来源:互联网 发布:hp1005扫描软件 编辑:程序博客网 时间:2024/06/01 09:50
转自:http://blog.csdn.net/dongccc/article/details/41348157
最近在学习如何在C++里调用Java方法,遇到提示 #include <XXX.h> file not found 的问题。也google了好久都没有找到合适的解决方案。
认真的研究了下xcode导入h头文件的的工作机制,发现xcode里有个设置是配置查找头文件位置的地方。特地总结了下这次的教训。搞了我两天 -_-||
我这里做的动作是Cocos2dx的C++调用Android里的Java方法,上代码:
1.首先要保证,cpp调用文件的头一定要引入你的JniHelper.h的正确路径。我这里是
2.当代码里调用如下代码的时候,不会正常调用API:如果不配置xcode自动搜索头文件的配置,这里返回的应该是个int*类型的参数。肯定是不对的。应该是返回JNIEnv*类型的才对!3.进入到上面的JniHelper.h头文件内,会发现#include <jni.h> file not found的错误。
下面是解决方案:
1.xcode里点击你项目本身,然后在右侧找到project,然后Build Settings,在下面搜索栏里搜索“search”,找到下面Header Search Paths,双击编辑内容
2.在弹出框内的下方,有个“+”符号,添加条目,输入的内容为你android的NDK的路径。我这里本机存放的路径是:/opt/android-ndk-r9d/platforms/android-9/arch-arm/usr/include。
3.这回再回到JniHelper.h头文件,你就会发现错误提示没了,而且在cpp文件里,调用JniHelper::getEnv方法就可以正常使用了。
阅读全文
0 0
- XCode里遇到 #include <XXX.h>file not found的解决方案
- XCode里遇到 #include <XXX.h>file not found的解决方案
- XCode里遇到 #include <XXX.h>file not found的解决方案
- XCode--#include <XXX.h>file not found
- xxx.h file not found
- 错误:'xxx/xxx.h' file not found
- include“libavformat/avformat.h” file not found
- xcode4.3 "/usr/include/sqlite3.h" file not found
- iOS #include<Vectors/Vectors.h> file not found问题?
- Lexical or Preprocessor Issue ‘xxx.h’ file not found
- Xcode遇到Library not found for -XXX问题
- .h file not found
- XCode 4.2 – vector.h file not found
- Xcode解决SenTestingKit/SenTestingKit.h file not found 问题
- xcode文件找不到---“AFNetworking.h”file not found
- xcode archived issue:'Cordova/CDVViewController.h' file not found
- Xcode '*/*.h' file not found 此类问题解决方案
- xcode文件找不到---“AFNetworking.h”file not found
- Codeforces Beta Round #96 (Div. 1) C. Logo Turtle —— DP
- idea安装地址以及破解方法
- elasticsearch中的API
- caffe 学习之LayerParameter
- Javaweb简单博客系统-----(二)数据库建表
- XCode里遇到 #include <XXX.h>file not found的解决方案
- Python学习之旅-20
- ztree自定义按钮的显示和功能
- 《reinforcement learning:an introduction》第一章《The Reinforcement Learning Problem》总结
- POJ2912 I
- HDU1529 Cashier Employment 题解 【差分约束】【二分答案】
- SQL SERVER存储过程
- ReactNative 应用于原生应用 踩坑
- 安徽一个班37人考进清华北大,老师发来一则短信,家长沉默了