ryyst
ryyst

Reputation: 9791

C - linker error

I write a C program with Xcode 4. I include some OpenSSL header files:

#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>

This does not seem to work, as I get Apple Mach-O Linker (ld) Error: "..." referenced from: errors.

I have tried to include the OpenSSL framework, but I cannot find it in the list (I only find libssl which doesn't do the trick). What am I doing wrong?

Upvotes: 2

Views: 1190

Answers (1)

user557219
user557219

Reputation:

#include is relevant at the preprocessing/compiling phase. Since you’re getting linker errors, the problem is that you haven’t linked the appropriate libraries.

OpenSSL is not a framework in the Apple sense, which is why you haven’t found it. In your case, since libssl wasn't enough, you’re missing libcrypto (which is also part of OpenSSL).

Upvotes: 3

Related Questions