2

I've been trying to compile some C files to use in XCode that uses Openssl as a dependency for encryption. When compiling with clang the code compiles fine. I read a few posts on here like Setting C++ compile flags in xcode that says to put the flags under Other Linker Flags but I still couldn't get it to recognize it.

Here is the compiling command that works on the command line:

enter image description here

Flags in XCode:

enter image description here

The error in XCode:

enter image description here

9
  • 3
    setting compiler settings and header include paths under linker settings isn't going to work; that's not where you add user-defined header folders (i.e additional header directories). Open the schema editor for your target and search for "Header" (yes, there actually is a "search" facility to make it easier to find stuff). Commented Aug 6, 2018 at 21:36
  • Do I add it under "Header Search Paths"? Commented Aug 6, 2018 at 22:11
  • 1
    Yes, and only the include paths; not the warning settings, output target name, or any of the other stuff you have there. It should be just the added paths; no -I directives or anything like that; Xcode adds all of that when submitting to clang). Commented Aug 6, 2018 at 22:13
  • 1
    For one, the lib folder doesn't belong there. Additional library search paths has its own place in Xcode. Second, look at your errors. Those are link errors, not compile errors. Which means it is a different problem than the one you came here with. Your original problem was where to tell Xcode about additional header search paths: done. Now your problem is where to tell Xcode about additional library search paths, And yes, there is another path setting you can configure for Xcode that does that too. Commented Aug 6, 2018 at 22:25
  • 1
    I suspect it will be a combination of everything you've already done, and added to that, adding -lcrypto to your linker flags (where this all started). Commented Aug 6, 2018 at 23:51

1 Answer 1

3

Solution thanks to @WhozCraig

Add the include folder in "Header Search Paths" and library folder in "Library Search Paths"

enter image description here

Then put -lcrypto to link the files under "Other Link Flags"

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.