c - Including a dynamic library in an Xcode 4 project -


I apologize for the original question; So I hope that it will help other beginner programmers.

I have installed the MacPortes and after that I installed the external library: ImageMagick . From my research, I know that McPort has inserted the diligence in the / opt / local / lib / folder: I also know that header files / opt / local / include / imagemagick Are located in the / folder.

I thought I wanted to see how it ran away I created a new project, a C command line tool, then copied the first example to main.c Now I want to add Image Magazine libraries for my project.

Then how do I add files to my encoded project, so that #include & lt; Wand / magickWand.h & gt; work?

I have similar difficulty with external libraries with iPad projects to make both simulators and tools However, in case of your test you can try the following:

  1. Choose your project in Project Navigator. The most thing should be.
  2. In the expanded pane at the very top, you should see a list of tab labels, select the "Build Settings" tab.
  3. Until you find "LLVM GCC 4.2 - Language" section.
  4. Find "Other C Flag" and expand it if necessary You will see two sub items debug and release.
  5. Modify debug items for now and include a path reference such as -

      I / opt / local / to compile your code above Will allow, but now you will need to link it. You will need to add an additional link option.  
    1. Find the "Linking" section in the Build Settings panel.
    2. Expand the "Other Linker Flags" in the "Linking" section and if necessary.
    3. Modify the "debug" sub item for now There are two ways to add your desired library:

      With a library search path and library instructions as follows

        -l / opt / local / lib -lImageMagic  

      with full path to the library

        / opt / local / lib /libImageMagic.dylib (note that the actual filename is)     

      These changes worked for me, at least until I got to do this real Can not find the path of XCode 4 Received. It is still clumsy to be a proper approach to hope that some have correctly thought.

Comments