views:

826

answers:

5

Hello,

I need the openssl lib for some C code in my iPhone App. So I've put the lib into my project.

But when I compile it, Xcode throws me some errors:

error: openssl/ssl.h: No such file or directory

That's my code for including:

 #include <openssl/ssl.h>

Target settings in Xcode:

Which step am I missing to link it correctly?

+2  A: 

This is not a linking issue. This is the preprocessor not being able to locate the header file. You need to check where that header ended up, and perhaps alter Xcode's (or your project's) settings to include that location.

unwind
A: 

Thanks, I'll check the header's location and set Xcode up.

Zopi
+2  A: 

Since this appears to be for iPhone, you won't find it. OpenSSL is not available on the iPhone, not to third-party applications anyway. Compiling for the simulator might work, because it has all kinds of stuff that real devices don't. Getting this to compile for the phone is a non-starter-- the header's not found because it's not there, and if you somehow trick it into using a different copy, it'll fail to link.

Tom Harrington
This is false: OpenSSL can be compiled to run on iPhone devices.
titaniumdecoy
Maybe it is now but that answer was written 19 months ago, before iPhone OS 3 had shipped and well before the current iOS 4. It was accurate at the time, but of course things change.
Tom Harrington
+1  A: 

OpenSSL for iPhone is available at http://www.therareair.com/2009/01/01/tutorial-how-to-compile-openssl-for-the-iphone/

Compiled libraries too at end of article.

+1  A: 

Well, when a linked lib isn't found I now go here to see which library/framework I need to link to.

I know your problem was something else, but this should be useful for others.

http://developer.apple.com/iPhone/library/documentation/Xcode/Conceptual/iphone%5Fdevelopment/910-A-iPhone%5FSimulator%5FFrameworks/iphone%5Fsimulator%5Fframeworks.html

Also, to link the libraries, go to the targets area of xcode. Expand that area until you find "link binary with libraries". Right click and add existing framework. Click the plus at the bottom and then find the library you need and add it.

Neo42