views:

255

answers:

2

Hi all, I'm trying to use standard system header files in my C++ XCode project:

#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>

The build fails and it complains:

"Openssl/bio.h: No such file or directory"

I added /usr/include to the "Header Search Paths" in Project settings, but that doesn't fix it.

I COULD fix it by adding the whole path like:

#include </usr/include/openssl/bio.h>

-- but the project is full of similar includes and I don't want to change all of them this way. Also, I feel I shouldn't have to do this.

Another way to fix it would be as another thread mentioned, which is to add /usr/include to User Header Search Paths. But if I do that, then I'd have to change all the angle brackets <> to quotes "", which again seems like a hack. I mean, these are standard system header files so I feel it should be something simple, not requiring these kinds of hacks.

Any ideas?

Thanks!

A: 

It might depend on the fact that HFS(+) is case insensitive. The error message talks about "Openssl/bio.h" with capital "O", but you're specifying "openssl/bio.h" in the include and the path with /usr/include works.

I suspect that there's some "Openssl" (capital "O") directory in your include path, that gets used when looking for "openssl/bio.h". This wouldn't happen if HFS(+) were case sensitive from the very beginning (I know it's possible to have is case sensitive, but it's actually a PITA to use...)

polettix
Thanks for the response, polettix. The capital "O" is just XCode -- it always tries to be "proper" and starts things with capital letters, which more often than not serves only to confuse. But just to be sure, I did rename /usr/include/openssl to /usr/include/Openssl (I guess I could have symlinked it), but that didn't change anything :(
mindthief
+1  A: 

Xcode uses the currently selected SDK as a base path, which it prefixes on to system includes. So if your SDK is /Developer/SDKs/MacOSX10.6.sdk then it will look under /Developer/SDKs/MacOSX10.6.sdk/usr/include by default for system includes.

There are various possible workarounds - I would probably just put a symbolic link in /Developer/SDKs/MacOSX10.6.sdk/usr/include pointing at /usr/include/openssl but you can probably think of others now that you know the underlying problem.

Paul R
thanks Paul, I ended up doing something similar! But I didn't understand why it worked. It makes sense now, thanks!
mindthief