I have this C++ code which does not compile on OS X:
#include <iostream>
#include <openssl/evp.h>
int main(int argc,char *argv[]){
EVP_PKEY_CTX *pctx;
pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL);
return 0;
}
At link I get this error:
Undefined symbols for architecture x86_64:
"_EVP_PKEY_CTX_new_id", referenced from:
_main in test-a22ea1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
compiled with:
g++ test.cpp -o test -lssl -lcrypto
OpenSSl doc, says that it should be defined: https://www.openssl.org/docs/manmaster/crypto/EVP_PKEY_CTX_new.html
This code works perfectly on a Linux (Debian 7 with OpenSSL 1.0.1e). But not on OS X. Any suggestion?
My config:
- OS X: 10.11.2
- clang: Apple LLVM version 7.0.2 (clang-700.1.81)
- openSSL: OpenSSL 1.0.2e 3 Dec 2015 (installed with Homebrew)
Thank and happy new year :)