Why can't XCode 4 find my .h files during a build?

后端 未结 4 1688
面向向阳花
面向向阳花 2020-12-17 02:31

I have a project that won\'t build because the compiler (?) can\'t seem to find the .h files. I have tried using the full path, relative path and setting the Project Search

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-17 03:36

    I am posting this in order to make things simple for newbies like me that are integrating zxing qr reader in their projects and to bring closure to a couple of threads related to zxing integration.

    1. Main thing - Be absolutely sure you have the latest version.

    http://zxing.googlecode.com/svn/trunk/

    [By now, January 18th, you will have no more issues with that zxing/common/ folder. Easiest fix for this: get the latest code!]

    2. Go to zxing -> iphone -> ZXingWidget.

    Drag ZXingWidget.xcodeproj file and drop it onto the root of your Xcode project's "Groups and Files" sidebar.

    [you should now have ZXingWidget.xcodeproj listed there and it has to drop down and list it's content]

    3. In the same place, project navigator, select:

    Your project file - > Targets -> 'your project name' -> Build phases -> Link binary with libraries.

    You should find a folder named 'Workspace'. Add 'libZXingWidget.a' from within.

    4. Still in Build phases, expand Target Dependencies and add ZXingWidget.

    5. Select Build Settings and search for Header Search Paths. You need to add 2 records to Header Search Paths. You do not need to associate values to User Header Search Paths. You achieve this by double clicking the column on the right. A small popover window will apear. Use the + button to add the first record. Add:

    ../zxing/iphone/ZXingWidget/Classes

    Now use the + button to add the second record. Add:

    ../zxing/cpp/core/src

    These are the values I use. These values work because I use the same folder to host both my project and the zxing folder.

    [Be sure to refer your folder properly in case you decide to have a different file structure.]

    6. Go back to Build Phases and add the following ios frameworks required:

    AVFoundation

    AudioToolbox

    CoreVideo

    CoreMedia

    libiconv

    AddressBook

    AddressBookUI

    7.

    Create a set of files (.h&.m) and change it's .m extension to .mm

    8. Test the integration by including the following in the file previously created:

    #import 
    #import 
    

    At this point you should run into missing files only if you are not running the latest version. Hope this helps.

提交回复
热议问题