mjl007
mjl007

Reputation: 775

md5.h File Not Found error Xcode 7 for Mac application

I am trying to use the md5 module from the openSSL library. So in one of my header I included the openssl library by including it like this:

#include <openssl/md5.h>

However Xcode is giving me the message md5.h file not found. I went into my /usr/include and confirmed that openssl/md5.h was present.

Here are the things that I have tried to solve the issue:

I am currently running OS X 10.10.5 and my Xcode version is 7.0.1

Upvotes: 2

Views: 6640

Answers (2)

mjl007
mjl007

Reputation: 775

I have finally figured it out. In the latest version of Xcode, apparently it does not look in the /usr/include/. I even tried to add this to the User header search path, but that ended up throwing more errors.

So I had to manually copy into Xcode's own internal usr directory:

/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include

After copying over the openssl folder, relaunched xcode and the error went away. I dont know why apple decided to move the Developer's folder within the app itself or why it doesnt just look in the /usr/ folder like gcc/g++ does, but this is a workaround that works for me now.

Upvotes: 1

xryl669
xryl669

Reputation: 3614

You need to install Xcode Command line tools from here for your exact Xcode version: https://developer.apple.com/downloads/

Then, openssl source will be installed in /usr/include.

Also, you need to link with openssl by adding "-lcrypto" and "-lssl" (if you need SSL too) in your linker's flags

Upvotes: 1

Related Questions