Xcode - linking error _OBJC_CLASS_$_"className" after replacing class files

10,925

In your app's target, look in "Build Phases", in the "Link Binary With Libraries" phase.

It should include libChartBoost.a.

If it doesn't, press the + button and select libChartBoost.a.

I'm pretty certain this has something to do with the linker trying to use the references of the old files?

No. You removed the old files from the project, and that included the reference in the "Link Binary With Libraries" build phase. When you added the new files to the project, you didn't add that reference back.

Share:
10,925
CodingBeagle
Author by

CodingBeagle

Currently finishing my degree as a Software Engineer at Aarhus University School of Engineering. Besides school I have had various jobs working as a student developer.

Updated on June 08, 2022

Comments

  • CodingBeagle
    CodingBeagle almost 2 years

    Introduction

    In a current project I'm working on we're using the ChartBoost SDK for popop commercials. We've been using this SDK for a while now with no problem whatsoever. It is a very simple library that essentially only has 1 header file called "ChartBoost.h" as well as a "libChartBoost.a" file.

    Now we have just updated the SDK files with a new version. What I did here was simply removing the old SDK files from the project by "Move To Trash". What I did after was simply moving the new SDK files to the project, adding their references.

    The problem

    Right after doing this and compiling the project, I suddenly get 2 linking errors. Here's a screenshot of it:

    Screenshot

    I've tried pretty much everything I could think of to try and remove the error. I've cleaned the project and the project folder, and I've also tried to delete the derived data of the project through the organizer window.

    I'm pretty certain this has something to do with the linker trying to use the references of the old files? But I'm not sure how I could go about getting it to remove those now-invalid references.

    Is there anyone here who have any idea how this problem could be fixed?

    [EDIT] Linking ChartBoost.a to the binary

    So I tried linking the ChartBoost.a file to the binary through the "Build Phases" tab. This did get rid of the two original errors though revealed 8 new ones, shown in the screenshot below:

    Linking errors 2

    I'm not quite sure what these kind of linking errors are supposed to mean unfortunately :( Anyone got any ideas?

  • CodingBeagle
    CodingBeagle about 12 years
    I've updated the original question with details and screenshots of the results. It did get rid of the two original problems but revealed 8 new ones
  • Kurt Revis
    Kurt Revis about 12 years
    Look at the problematic class names and do a little research. SCNetworkReachabilityXXX is in the iOS SystemConfiguration framework, so add that to your linked libraries. SBJson3Parser is a JSON parser library that your libChartBoost is using. You see all those files in the JSON3 folder in the latest version of the ChartBoost SDK? Add them to your project!
  • CodingBeagle
    CodingBeagle about 12 years
    Well, adding the SystemConfiguration Network did the trick for 6 of the errors. Now the only problem that remains is the fact that I get the original error again, only this time with "SBJson3Parser", which is apparently referenced in the libChartBoost.a library. The only problem is that The JSON3 Folder which comes with the ChartBoost library does not have any library file itself to include. I have included this folder as a part of the project by the way. It's just very odd as when we implemented ChartBoost the first time, we did not have to mess about with these library includes.
  • CodingBeagle
    CodingBeagle about 12 years
    Actually you can see the error in the top of the screenshot, which is what remains: "_OBJC_CLASS_$_SBJson3Parser". I have included the folder and all of its files as part of the project.
  • Kurt Revis
    Kurt Revis about 12 years
    You see all those .m files in JSON3? Make sure they are in the "Compile Sources" build phase of your target. As for why things changed: why don't you ask the ChartBoost people? Presumably they can explain!
  • CodingBeagle
    CodingBeagle about 12 years
    Aha! Adding the JSON .m files under the compile sources in the target did the trick :) Awesome! When it comes to linking I am still quite inexperienced. Glad you took the time to help :) Thank you!
  • gunjot singh
    gunjot singh almost 7 years
    It helped! Thank you