Linking to libraries in Xcode

Discussion in 'Mac Programming' started by vatel, Jun 3, 2005.

  1. vatel macrumors member

    May 6, 2005
    I'm new to XCode, so this is a pretty basic question.

    I am trying to build a C++ console app, and I can't figure out how to get the linker to use the necessary libraries. I couldn't find any info on what to do with libraries in the documentation, so I dumped them into the source for the project, but that doesn't seem to work, as I get a whole list of missing symbols from the link.

  2. Loge macrumors 68030


    Jun 24, 2004
    I think within Xcode, you need to choose File | New Project..

    then from the list, choose

    Command Line Utility, C++ Tool.

    This should set up your project to link with the required libraries, then you can change the boilerplate main.cpp file to create your command line program.
  3. superbovine macrumors 68030


    Nov 7, 2003

    just make a makefile in your src directory then edit the active target.

    Attached Files:

  4. AlmostThere macrumors 6502a

    Assuming you have the project set up for c++ compiling, further libraries can be added under Groups and Files.

    Under the Project Group in groups and files, right click on External Frameworks and Libraries and choose Add -> Existing Files and then navigate to the library you want. If you require some common functionality, Apple probably produce a "Framework" which drags libraries, headers and any other resources you need into your project.

    It really is very easy.

Share This Page