mac openssl 找不到头文件解决方法

os x从10.10更新到10.11后,原有代码编译报错,#include <openssl/ssl.h>等头文件无法找到: "openssl/ssl.h: No such file or directory".

原有环境:os x10.10+Xcode6

更新后的环境:os x10.11+Xcode7, Qt5.3.1+Qt Creator 3.3.0

 

解决办法:

1.命令行执行:xcode-select —install,安装xcode命令行工具,/usr路径下出现include目录 (如果原来/usr/include目录已经存在,跳过这一步);

   /usr/include/openssl目录里包含了相关的头文件

2.在/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/路径下创建openssl目录;

3.把 /usr/include/openssl路径下的所有文件拷贝到刚建立的openssl目录下;

 

原因:

os x10.11开始,苹果sdk中不再提供openssl,在Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include路径下是找不到原有的openssl目录的。

"

Sadly, it looks like we're not supposed to use it any more.  As you say, it's included in the 10.10 SDK, but is deliberately missing from the 10.11 SDK.

http://lists.apple.com/archives/macnetworkprog/2015/Jun/msg00025.html

"

 

参考:

1.https://forums.developer.apple.com/thread/3897

2.http://stackoverflow.com/questions/14655154/mac-os-x-lion-does-not-have-usr-include-folder

 

另外升级后,Qt Creator中编译会报找不到<sys/time.h>等系统头文件,修改~/Qt5.3.1/5.3/clang_64/mkspecs/qdevice.pri文件,把macsox10.10改为macosx10.11即可以解决问题。


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值