Linker error: symbol(s) not found

Hello everyone,

I'm building my first Cocoa app (well, other than my "hello world"). I'm running into a strange problem when I try to build. The linker gives me the following error when I try to init a custom class (called 'RailsApp'):

Undefined symbols:
".objc class_nameRailsApp", referenced from:
literal-pointer@ _OBJC@__clsrefs@RailsApp in MainController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Now, there is an import statement in the header file to the 'RailsApp' header file. I've tried moving this around, etc to no avail. I really don't know what else I should do.

If anyone can help a beginner it'd be greatly appreciated!

Ernest

Macbook Pro, Mac OS X (10.5.2)

Posted on Mar 16, 2008 7:37 PM

Reply
16 replies

Mar 16, 2008 8:04 PM in response to solid_root

Okay, I figured this one out. I added the implementation file to "Compile Sources" on the target in question. I though XCode would be smart enough to figure out I wanted to compile an implementation file, but guess not...

Now I'm having another issue: I can build just fine, but the **** application just won't launch! If I try to launch it manually by right clicking on it and running it, XCode gets a bunch of errors and basically forces me to quit..

This is starting to be a real pain in the ***. I've got to say, the Mac dev tools seem incredibly dates (and buggy)

May 19, 2009 12:30 PM in response to solid_root

I know this question has been answered - but I thought this might help someone:

I had added the security framework via the method above (right click on frameworks > add existing frameworks...) but only applied it to my Main.app as a target.

I have a small bundled app which implements a 'request for admin password' when running a sudo command within my main app. I had to delete the security framework and add it again to apply it to the both the bundled app as well as my main app.

It's confusing as I hadn't realised it needed to be bound to both - nor in fact realised that the framework, when it exists isn't visible to both - but happy I've solved this problem. Hope this is useful to someone.

Jul 12, 2009 8:55 AM in response to cjcj

Hi- Just posting this in case anyone else has a similar problem.

I was getting this same type of error trying to link in the GameKit framework.

I tried deleting the framework (in xcode) and I got the exact same error.. (telling me that it's obviously a link problem and not a code ref problem)

I tried adding back via menu & drag and drop from another app where GameKit is working.... checked targets (only one app, and it's checked).. also made sure GameKit shows up in Link Binary With Libraries folder... no luck, no luck, no luck....

Finally (no idea why I tried this) I went to Finder and found that a copy of the GameKit framework folder was still in my app folder.... as soon as I deleted this, everything linked up just fine

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Linker error: symbol(s) not found

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