Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

XCode and C++ linking

Hello,
first of all, if there is a better place to ask developer-questions concerning xcode and c++ please tell me 😉

I am currently working on a c++ project and I am using XCode 2.3.
The problem is the following:

I have a folder for my project files and another folder where other c++ files are stored (a whole big package). Within my files, I am including files from the project-external folder. The include itself is working, because it recognizes the classes and their methods, etc.

Nevertheless, there seems to be a linking problem (ZeroLink is turned off):
Linking (1 error)
Undefined symbols:
Tribots::ConfigReader::append fromfile(char const*, bool)
etc. etc. etc.

I tried to explicitly include the external files in the "Linking Binary with Library" section, but afterwards I had the problem that the used paths were related to the external folder and not my project folder.

How do I manage to get XCode link all needed files (the included and used ones) right? It does not even seem to compile the included .cpp files ;(

By the way: I tried to compile the whole thing using a makefile and it worked, so the error has to be somewhere within my XCode configuration..

Thanks a lot for your time and help,

Greetings,
Tim

PB G4, Mac OS X (10.4.6), XCode 2.3 GCC 4.0

Posted on Jun 10, 2006 6:01 AM

Reply
7 replies

Jun 11, 2006 3:37 PM in response to Tim Kietzmann

Are there no XCode and C++ users out there??


Sure there are. I'm one, but the problem you describe doesn't sound like anything I've encountered. If I get a link error, it's because I haven't added the appropriate source to the target. All I can suggest is that you look at some sample projects, such as those in /Developer/Examples, and try to figure out how they differ from your project.

Jun 12, 2006 1:01 AM in response to James Walker1

how do you add the files to the targets? Do you simply add all .o files you need in there? I am dealing with a whole project (where I am using some files from) with highly interrelated c++ files. I guess I would have to add about 80 files. How can I deal with the subfolders etc?

I looked through the examples XCode gives, but could not find any c++ files. Any suggestions?

Thanks a lot again,
Tim

Jun 12, 2006 10:29 PM in response to Tim Kietzmann

how do you add the files to the targets? Do you
simply add all .o files you need in there?


Not .o files, source files. Add both sources and headers. In the target column of the Xcode project window, you should see checkmarks for the sources.

I am
dealing with a whole project (where I am using some
files from) with highly interrelated c++ files. I
guess I would have to add about 80 files. How can I
deal with the subfolders etc?


One way to do it would be to put the Finder in hierarchical list view, select all the source and header files you want, and drag the whole mess into the project window.

I looked through the examples XCode gives, but could
not find any c++ files. Any suggestions?


There are C++ files under Carbon. Just to name one, /Developer/Examples/Carbon/ScrollView. Maybe you looked for .cpp, but .cp also means C++.

XCode and C++ linking

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.