Android Studio NDK:使用预构建的OpenSll库 - 错误查找包括文件
我下载了Android Studio和NDK(Android Studio Bumblebee | 2021.1补丁3),并在我的Android手机上成功运行了“ Hello Word” CPP示例项目。 伟大的! 现在,我想在项目中使用OpenSSL功能和方法。
我从: https:// teskalabs下载了一个预构建的android二进制文件。 com/blog/openssl-binary-distribution-for-developers static-library 现在想在我的项目中包括静态库和标头文件。
在Android Studio中,我创建了一个“ Include”文件夹,其中我从Dowdloaded OpenSSL文件夹中复制了所有 *.H文件。我还添加了include_directories(src/main/cpp/include)
在cmakelist.txt中。 最后,我添加了行#include< ssl.h>
到本机lib.cpp-没事,没有openssl函数等。 当我尝试制作项目时,我会收到一个编译错误:致命错误:'ssl.h'文件找不到
。如果我取出“ inclage”行,则所有内容都可以编译并运行正常。我还尝试了#include“ ssl.h”
- 相同的错误。 我正在使用Windows 10。 我的项目树看起来像这样:
...
v main
|
cpp
|
> include
CMakeList.txt
native-lib.cpp
...
如果我打开“ inclage”选项卡,则具有所有ssl.h等文件。
我在做什么错?为什么Android Studio找到标题文件?
I dowloaded Android studio and NDK (Android Studio Bumblebee | 2021.1.1 Patch 3) and compiled and run the "Hello Word" CPP example project successfully on my Android phone.
Great!
Now I want to use openssl functions and methods in my project.
I downloaded a prebuilt Android binaries from: https://teskalabs.com/blog/openssl-binary-distribution-for-developers-static-library and now want to include the static libraries and header files in my project.
In Android Studio I created an "include" folder where I copied all *.h files from dowdloaded openssl folder. I also added include_directories(src/main/cpp/include)
in CMakeList.txt.
Lastly I added line #include <ssl.h>
to native-lib.cpp - nothing else, no openssl function etc.
When I try to make my project I get a compile error: fatal error: 'ssl.h' file not found
. If I take out the "include" line everything compiles and runs fine. I also tried #include "ssl.h"
- same error.
I am using Windows 10.
My project tree looks like this:
...
v main
|
cpp
|
> include
CMakeList.txt
native-lib.cpp
...
If I open the "include" tab it has all the ssl.h etc files.
What am I doing wrong? Why does Android Studio find the header files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过三天的尝试和尝试,并提出问题,我终于找到了问题所在。
而不是使用:
我使用了:
现在它链接
After 3 days of trying and trying and afer posting the question I finally found what the problem was in my case.
Instead of using:
I used this:
Now it links