Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vatel

macrumors member
Original poster
May 6, 2005
47
0
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.

Help.
 

Loge

macrumors 68030
Jun 24, 2004
2,836
1,312
England
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.
 

superbovine

macrumors 68030
Nov 7, 2003
2,872
0
Loge said:
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.


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

Attachments

  • target.jpg
    target.jpg
    109.8 KB · Views: 708
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.