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

前端 未结 4 1575
故里飘歌
故里飘歌 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:33

    The problem is that the include file in /usr/include are for Mac OS X, not for the iPhone/iPad. If you want to get things to work you will have to add (at least) the flags that Kay mentioned in her comment...

    A much easier way to go about this is to use XCode. Just create a new project (choose the Cocoa Touch Static Library) and add the source files. According to the Makefile you will need to add: utils.c dcc.c errors.c portable.c sockets.c colors.c

    Hope this helps.

    You might also check out IRCClient which is a Objective-C wrapper for the library you are using. No point reinventing the wheel!

    ADDITIONAL INFORMATION 5/8/11

    Turns out the Objective-C wrapper is aimed at Mac OS X not iOS

    Here's what you need to do to get this to compile:

    Get the sources fresh:

    svn co https://libircclient.svn.sourceforge.net/svnroot/libircclient libircclient
    

    Change into the libircclient/trunk/libircclient/src directory and run

    ./configure
    

    Note: this is a slightly dirty trick. This is really configuring for Mac OS X but most of the times things are similar enough for this to work. This generates a file called config.h in include.

    Fire up XCode and choose to create a new Cocoa Touch static library. When prompted create a new directory libircclient/trunk/libircclient/iOS and save the new project there.

    Add the file libircclient.c from libircclient/trunk/libircclient/src to the project. It turns out that this file includes all the other C files.

    Open your project settings and add ../../include to you search header path.

    Build and enjoy!

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题