Help Linking on Xcode

Discussion in 'Mac Programming' started by cruzrojas, Oct 1, 2007.

  1. cruzrojas macrumors member

    cruzrojas

    Joined:
    Mar 26, 2007
    Location:
    USA
    #1
    Hi, I need some help with xcode.
    I installed in my mac the gsl (gnu scientific library) from gnu. And I have been using it without any problem. I have been using the terminal to compile the code in the following way

    Code:
    >g++ -Wall -c program.cpp
    >g++ program.o -lgsl -lgslcblas -lm
    now how can I link this libraries to xcode so I can compile a project from xcode.

    Any help will be appreciated. In advance thanks.
     
  2. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #2
    Add the libraries to your Xcode project. Choose Project > Add to Project, or right-click from the Groups and Files list to open a contextual menu that lets you add files to the project.

    After adding the libraries, you want to make sure they will get linked. Click the disclosure triangle next to Targets in the Groups and Files list to see the target for your project. Click the disclosure triangle next to the target to see the target's build phases. There should be a build phase called Link Binary with Libraries. Make sure your libraries are in that build phase. If not, drag the libraries from the Groups and Files list to the Link Binary with Libraries build phase.

    If you can't link at this point, you may need to add a search path to the libraries. Select the name of your project from the Groups and Files list and click the Info button in the project window toolbar. This will open the project's information panel. Click the Build tab on the information panel. Choose Search Paths from the Collection menu. Add the path to the libraries to the Library Search Paths setting.
     

Share This Page