openssl / ssl。没有找到,但是装了自制的。

时间:2022-09-18 23:11:34

I am working on a C++ project on my Mac running El Capitan and I get this error even after installing openssl with Homebrew:

我正在运行一个c++项目,在我的Mac上运行El Capitan,即使在使用Homebrew安装openssl后,我也会得到这个错误:

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

LDFLAGS:- l / usr /地方/ opt / openssl / lib

CPPFLAGS: -I/usr/local/opt/openssl/include

CPPFLAGS:我/ usr /地方/ opt / openssl /包括

How to make it work without this flags?

如何让它在没有国旗的情况下工作?

Openssl use to work on El Capitan installed with brew, but I reinstalled OS X and update openssl with homebrew and here I am.

Openssl用于在El Capitan上安装了brew,但是我重新安装了OS X,并使用homebrew更新了Openssl,现在我在这里。

Thank

谢谢

1 个解决方案

#1


7  

I found the solution: clang was not looking in the right place.

我找到了解决办法:clang没有找对地方。

xcode-select --install

This post resolved this issue: On mac, g++ (clang) fails to search /usr/local/include and /usr/local/lib by default

这篇文章解决了这个问题:在mac上,g++ (clang)在默认情况下无法搜索/usr/local/include和/usr/local/lib。

#1


7  

I found the solution: clang was not looking in the right place.

我找到了解决办法:clang没有找对地方。

xcode-select --install

This post resolved this issue: On mac, g++ (clang) fails to search /usr/local/include and /usr/local/lib by default

这篇文章解决了这个问题:在mac上,g++ (clang)在默认情况下无法搜索/usr/local/include和/usr/local/lib。