woutr_be
woutr_be

Reputation: 9732

Linking error references

I was trying to update a framework that we used before, since they had completely renewed it, there wasn't just a simple way of updating the files.

In my project I just removed the current framework and added the newer one. After some testing I wanted to go back to the old version, so I removed the new framework and added the old one again. So basically nothing changed in the code or in the files.

But still, when I try to build my files now, I'm getting this linking error, again, no changes to the code were made.

ld: duplicate symbol _OBJC_IVAR_$_DocumentViewController.thumbPage in /Users/wouter/Library/Developer/Xcode/DerivedData/WiC-dubdfuwbsdrffuatbuonqmpzuvcz/Build/Intermediates/WiC.build/Debug-iphonesimulator/WiC.build/Objects-normal/i386/DocumentViewController-B98A1B42C236E973.o and /Users/wouter/Library/Developer/Xcode/DerivedData/WiC-dubdfuwbsdrffuatbuonqmpzuvcz/Build/Intermediates/WiC.build/Debug-iphonesimulator/WiC.build/Objects-normal/i386/DocumentViewController-B98A1B42C236E973.o for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Why would it give me this error if everything is the same as before? My guess is that Xcode keeps some references (even though I asked to delete them) to deleted files.

Any ideas on how to get rid of this?

Upvotes: 0

Views: 71

Answers (3)

pho0
pho0

Reputation: 1751

Are you sure you're at the same revision? Can you back out to that version with git?

So you're project is finding at least 2 copies of ivar DocumentViewController.thumbPage ... Did you:

  1. Do a Clean All
  2. Delete the build directory

If that doesn't work, I would search the project or the project.pbxproj file (just using a text editor) and seeing if you can find the object or 2 frameworks that would be added to your target that contains this.

If that doesn't work, blow away the .xcodeproj directory and just created a new one and add all your files to it ... but this is as last resort.

Upvotes: 2

woutr_be
woutr_be

Reputation: 9732

Turns out that my "Compile Sources" was keeping a references to the same file previously deleted, trying to delete it didn't help. After doing a Clean and Clean build folder the problem was magically fixed.

Upvotes: 1

CodaFi
CodaFi

Reputation: 43330

I'll bet that you accidentally #imported a .m file instead of a .h file. Check to make sure that your #import reads

#import DocumentViewController.h

Do a clean and run again.

Upvotes: 1

Related Questions