找不到openssl/ssl.h,但与自制软件一起安装 [英] openssl/ssl.h not found but installed with homebrew
问题描述
我正在Mac上运行El Capitan的Mac上开发一个C ++项目,即使在用Homebrew安装openssl之后,我仍然收到此错误:
I am working on a C++ project on my Mac running El Capitan and I get this error even after installing openssl with Homebrew:
g++ -Wall -g -std=c++11 -I../libSocket/src -I../libData/src -c src/fsslhandler.cpp -o obj/fsslhandler.o
In file included from src/fsslhandler.cpp:1:
In file included from src/fsslhandler.h:8:
../libSocket/src/sslsocket.h:6:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
make: *** [obj/fsslhandler.o] Error 1
寻找解决方案后,我发现了一个不起作用的问题:
After searching for a solution I found one which does not work:
brew link openssl --force
为了使其工作,我必须在编译时添加以下标志:
In order to make it work, I have to add the following flags at compilation:
LDFLAGS:-L/usr/local/opt/openssl/lib
CPPFLAGS:-I/usr/local/opt/openssl/include
CPPFLAGS: -I/usr/local/opt/openssl/include
如何在没有此标志的情况下使其正常工作?
使用Openssl可以在Brew上安装的El Capitan上工作,但是我重新安装了OS X并使用自制软件更新了openssl,就在这里.
Openssl use to work on El Capitan installed with brew, but I reinstalled OS X and update openssl with homebrew and here I am.
谢谢
推荐答案
我找到了解决方案:lang不在正确的位置.
I found the solution: clang was not looking in the right place.
xcode-select --install
This post resolved this issue: On mac, g++ (clang) fails to search /usr/local/include and /usr/local/lib by default
这篇关于找不到openssl/ssl.h,但与自制软件一起安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!