Include Headers from added frameworks on Xcode

前端 未结 5 1574
無奈伤痛
無奈伤痛 2021-01-30 20:52

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 ->

5条回答
  •  感动是毒
    2021-01-30 21:46

    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:

    • Complete the Framework Search Paths with the path of your framework
    • Do the same with User 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:

    1. In the project navigator, select your project
    2. Select your target
    3. Select the 'Build Phases' tab
    4. Open 'Link Binaries With Libraries' expander
    5. Click the '+' button
    6. Select your framework
    7. (optional) Drag and drop the added framework to the 'Frameworks' group

提交回复
热议问题