I'm trying to import openssl header into my cpp file on macos like this :
#include <openssl/sha.h> #include <openssl/md5.h>
I try to install openssl with :
brew install openssl brew link --force openssl
then I got this:
Warning: Refusing to link macOS provided/shadowed software: openssl@3 If you need to have openssl@3 first in your PATH, run: echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc For compilers to find openssl@3 you may need to set: export LDFLAGS="-L/usr/local/opt/openssl@3/lib" export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
so I run :
echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc export CPPFLAGS="-I/usr/local/opt/openssl@3/include" export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
to run my file I use
g++ -lcrypto -lssl main.cpp -o main && ./main
but I got all this warning and library not found :
main.cpp:14:3: warning: 'MD5' is deprecated [-Wdeprecated-declarations] MD5((unsigned char*)s, strlen(s), empreinte); ^ /usr/local/include/openssl/md5.h:52:1: note: 'MD5' has been explicitly marked deprecated here OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n, ^ /usr/local/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0' # define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0) ^ /usr/local/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED' # define OSSL_DEPRECATED(since) __attribute__((deprecated)) ^ 1 warning generated. ld: library not found for -lcrypto
Any solution ?