iPhone - Why can the compiler not find some includes when building for ARM architecture?

前端 未结 4 1610
故里飘歌
故里飘歌 2021-01-05 18:58

I am trying to make use of a C library in an iPhone project. I am very green with iPhone development. My Library

I have been battling for days now to try and get th

4条回答
  •  佛祖请我去吃肉
    2021-01-05 19:16

    As Kay indicated in a comment, if you are trying to build from the command line (or via Make), you must specify the -isysroot $(SDKROOT) flag in order to get the correct headers (otherwise you pick up the host Mac OS X headers, which do not necessarily support ARM).

    The easiest thing is to build with XCode, or find a version of the library designed to build for iOS, but if you must use an existing Make-driven build system, you can adapt it to build for iOS by setting:

    TARGETSDK = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk
    CC = xcrun -sdk $(TARGETSDK) gcc
    CFLAGS = -arch armv7 -isysroot $(TARGETSDK) ...
    

    You will want to use similar xcrun commands for other tools used in your build.

提交回复
热议问题