md5.h 文件未找到错误 Xcode 7 for Mac 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32997707/
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-15 08:00:43  来源:igfitidea点击:

md5.h File Not Found error Xcode 7 for Mac application

c++objective-cxcodemacososx-yosemite

提问by mjl007

I am trying to use the md5 module from the openSSL library. So in one of my header I included the openssl library by including it like this:

我正在尝试使用 openSSL 库中的 md5 模块。因此,在我的标题之一中,我通过如下方式包含了 openssl 库:

#include <openssl/md5.h>

However Xcode is giving me the message md5.h file not found. I went into my /usr/include and confirmed that openssl/md5.h was present.

但是 Xcode 给我消息 md5.h 文件未找到。我进入我的 /usr/include 并确认存在 openssl/md5.h。

Here are the things that I have tried to solve the issue:

以下是我尝试解决问题的方法:

  • I cleaned my project
  • Made sure to include the libcrypto.dylib in the framework/library section
  • I have included the /usr/include/ in the User Header search path and Header search path within the build settings and have set it to recursively search sub directories
  • 我清理了我的项目
  • 确保在框架/库部分包含 libcrypto.dylib
  • 我已将 /usr/include/ 包含在构建设置中的 User Header 搜索路径和 Header 搜索路径中,并将其设置为递归搜索子目录

I am currently running OS X 10.10.5 and my Xcode version is 7.0.1

我目前运行的是 OS X 10.10.5,我的 Xcode 版本是 7.0.1

采纳答案by mjl007

I have finally figured it out. In the latest version of Xcode, apparently it does not look in the /usr/include/. I even tried to add this to the User header search path, but that ended up throwing more errors.

我终于想通了。在最新版本的 Xcode 中,显然它不在 /usr/include/ 中。我什至尝试将其添加到用户标头搜索路径中,但最终引发了更多错误。

So I had to manually copy into Xcode's own internal usr directory:

所以我不得不手动复制到 Xcode 自己的内部 usr 目录中:

/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include

/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include

After copying over the openssl folder, relaunched xcode and the error went away. I dont know why apple decided to move the Developer's folder within the app itself or why it doesnt just look in the /usr/ folder like gcc/g++ does, but this is a workaround that works for me now.

复制完 openssl 文件夹后,重新启动 xcode 并且错误消失了。我不知道为什么苹果决定在应用程序本身中移动开发人员的文件夹,或者为什么它不像 gcc/g++ 那样只在 /usr/ 文件夹中查找,但这是一种现在对我有用的解决方法。

回答by xryl669

You need to install Xcode Command line tools from here for your exact Xcode version: https://developer.apple.com/downloads/

您需要从这里为您的确切 Xcode 版本安装 Xcode 命令行工具:https: //developer.apple.com/downloads/

Then, openssl source will be installed in /usr/include.

然后,openssl 源将安装在 /usr/include 中。

Also, you need to link with openssl by adding "-lcrypto" and "-lssl" (if you need SSL too) in your linker's flags

此外,您需要通过在链接器的标志中添加“-lcrypto”和“-lssl”(如果您也需要 SSL)来与 openssl 链接