macOS brew 安装 openssl lib

brew install openssl

openssl已经安装成功,但是在程序引用时,仍然会报错无法找到openssl的头文件和库,这是因为brew安装到了

/usr/local/Cellar

目录下,需要建立两个软连接 ,即

在【/usr/local/include】目录建立openssl的目录软连接 :openssl -> ../Cellar/openssl/1.0.2q/include/openssl

在【/usr/local/lib】目录建立libssl.dylib和libcrypto.dylib的两个文件软连接 :

libcrypto.dylib -> ../Cellar/openssl/1.0.2q/lib/libcrypto.1.0.0.dylib

libssl.dylib -> ../Cellar/openssl/1.0.2q/lib/libssl.1.0.0.dylib

可以自动写代码了

➜  myopenssl g++ get_web_by_https.cc -lssl -lcrypto -o get_web_by_https

猜你喜欢

转载自blog.csdn.net/IdeasPad/article/details/88095724