I want to work with some frameworks like glew
and cg
so i manually added
the needed frameworks to my project by right clicking the project -> Add files to ...
and choosing the correct framework. The problem is, when i try to include the header files,
Xcode cant find any of them. I hope this picture will help to understand:
And:
The error given is for the glew
framework, but it also happens on Cg
.
As you can see on the left, The needed frameworks were added.
Any idea on how i can include these headers?
After trying to add the header files manually i got an architecture error:
I dont know if this is how it should look like. Thanks!
Look at Preferences->Locations->"Custom Paths" in Xcode's preference. A path added here will be a variable which you can add to "Header Search Paths" in project build settings as "$cppheaders", if you saved the custom path with that name. Set HEADER_SEARCH_PATHS parameter in build settings on project info.
To include a framework in your Xcode project, choose Project > Add to Project and select the framework directory. Alternatively, you can control-click your project group and choose Add Files > Existing Frameworks from the contextual menu.
Before starting, remove the framework and all files you have added while trying to make it work.
Then, you have to add the frameworks in the Build Phases
of your target. Then go into Link Binary With Libraries
and select your framework from there.
This should do it. Your headers should be available as auto-completion after each #import directive.
If it does not work (it sometimes happens), there are additional steps I can provide to you.
Additional steps:
Go to your project settings, in the build settings:
Framework Search Paths
with the path of your frameworkUser Header Search Path
Then, it should work. If it does not, you will need to add the full path of your header in the #import
directive. Example:
#import "/path/to/my/header.h"
Apple's documentation available here states:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With