eclipse 未解决的包含:<jni.h>

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6572288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:33:34  来源:igfitidea点击:

Unresolved inclusion: <jni.h>

androideclipseandroid-ndk

提问by SirHamlet

I have some troubles with eclipse & sequoyah. I wrote a simple app, and without sequoyah it builds successfully. But it falls in emulator, so I decided to use sequoyah for native debugging. And after sequoyah's installation I see that unresolved inclusion don't allow me to build & run the project. Can anybody help me with it? Thanks.

我在使用 eclipse 和 sequoyah 时遇到了一些麻烦。我写了一个简单的应用程序,没有 sequoyah 就可以成功构建。但它属于模拟器,所以我决定使用 sequoyah 进行本机调试。在 sequoyah 安装后,我看到未解决的包含不允许我构建和运行项目。有人可以帮我吗?谢谢。

回答by Tiago

I had to do the following steps to get rid of this warning:

我必须执行以下步骤才能消除此警告:

  1. Open Eclipse's Navigator View (so you can see hidden files).
  2. Delete .project and .cproject.
  3. Clean (you might get some errors, but that's normal) and restart Eclipse.
  4. File -> New -> Other -> C/C++ -> Convert to a C/C++ project.
  5. Make sure to select C++ in the Radio button. Also, select the GNU Make (do NOTselect the Android Make one!).
  6. Clean the project.
  7. Right click on Project -> Properties -> C/C++ General -> Paths and Symbols. Go to the "Includes" tab and include the folder path for the "include" directory of the desired target (in my case it was "/Developer/AndroidNDK/platforms/android-9/arch-arm/usr/include")
  8. Before clicking on "Ok", check the "Apply to all" checkbox.
  9. Restart Eclipse one last time and the warning should be gone!
  1. 打开 Eclipse 的 Navigator View(这样您就可以看到隐藏的文件)。
  2. 删除 .project 和 .cproject。
  3. 清理(​​您可能会遇到一些错误,但这是正常的)并重新启动 Eclipse。
  4. 文件 -> 新建 -> 其他 -> C/C++ -> 转换为 C/C++ 项目。
  5. 确保在单选按钮中选择 C++。另外,选择 GNU Make(不要选择 Android Make one!)。
  6. 清理项目。
  7. 右键单击项目 -> 属性 -> C/C++ 常规 -> 路径和符号。转到“包含”选项卡并包含所需目标的“包含”目录的文件夹路径(在我的情况下是“/Developer/AndroidNDK/platforms/android-9/arch-arm/usr/include”)
  8. 在单击“确定”之前,选中“全部应用”复选框。
  9. 最后一次重新启动 Eclipse,警告应该消失了!

Hope it helps.

希望能帮助到你。

回答by Vinayak

Assuming Android NDK is downloaded and NDK-HOME and Path are set.

假设下载了 Android NDK 并设置了 NDK-HOME 和 Path。

Add Android NDK reference in Eclipse ->Windows->Preference->Android->NDK here set a path of NDK folder Restart Eclipse Right click on project ->Android Tools->Add Native Support

在 Eclipse 中添加 Android NDK 引用 ->Windows->Preference->Android->NDK 此处设置 NDK 文件夹的路径 重启 Eclipse 右键单击​​项目 ->Android Tools->Add Native Support

It will add all relevant things automatically.

它会自动添加所有相关的东西。

Ur Problem will solve :)

你的问题会解决:)

回答by mox

you need to add jni.h to your project's path.

您需要将 jni.h 添加到您的项目路径中。

add following paths to: Project -> Properties -> C/C++ General -> Paths and Symbols -> "Includes" -> GNU C++

将以下路径添加到:Project -> Properties -> C/C++ General -> Paths and Symbols -> "Includes" -> GNU C++

${NDK_ROOT}\sources\cxx-stl\gnu-libstdc++\4.8\include

${NDK_ROOT}\sources\cxx-stl\gnu-libstdc++\4.8\include

${NDK_ROOT}\platforms\android-9\arch-x86\usr\include

${NDK_ROOT}\platforms\android-9\arch-x86\usr\include

clean your project.

清理你的项目。

回答by Tancho

jni.h is an included part of the NDK, the fact that eclipse wont see it is that it doesn't know where it is.

jni.h 是 NDK 的一个包含部分,eclipse 看不到它的事实是它不知道它在哪里。

in the c++ properties of your project you should include the NDK includes for your platform located in {ANDROID_NDK}/platforms/android-{version}/arch/arm/usr/includeyou can get more info on setting your ide here

在您的项目的 c++ 属性中,您应该包含 NDK 包含的平台,{ANDROID_NDK}/platforms/android-{version}/arch/arm/usr/include您可以在此处获取有关设置 ide 的更多信息

But I don't think that's your problem, even if eclipse shows you errors, since it's not setup properly it will not provide any help..

但我不认为那是你的问题,即使 eclipse 向你显示错误,因为它没有正确设置它不会提供任何帮助..

post your errors from logcat maybe we can help?

从 logcat 发布您的错误,也许我们可以提供帮助?