Undefined symbols for architecture x86_64 on Xcode 6.1
Asked Answered
N

13

42

All of a sudden Xcode threw me this error at compilation time:

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Format", referenced from:
 objc-class-ref in WOExerciseListViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

After doing some research, I may understand that a library I'm using is not compatible with 64 bit version. But this is very strange since I've been working with the same libraries for at least a week without having a single compilation problem during that time. The two libraries are just composed of a bunch of classes, and when I removed them from my project I got the same issue. Since I have never created libraries myself, I have no idea how I can find wether the ones I'm using are compatible with 64 bit (?) I also tried the following changes for architectures under the target panel :

  • added $(ARCHS_STANDARD_INCLUDING_64_BIT) to the Architectures
  • build active architecture only -> set to 'NO'
  • for 'valid architectures' -> set to arm64, armv7 and armv7s
  • deleted the DerivedData folder and its contents, cleaned and built again

But none of these changes work. Please, does someone have a clue on this? Thanks

Nubble answered 25/10, 2014 at 6:32 Comment(3)
you changed or moved the file "WOExerciseListViewController" in your xcodeWindsor
Ultimately if you want to know the architecture and contents of the library then you'll need to use file, lipo, nm and ar to investigate.Dreamadreamer
I removed all references to these 3rd party classes from my code, but I still get the same issue: "undefined symbols for architecture i386" and same thing for architecture x86_64. @Dreamadreamer I'm a newbie, when I say 'library' I mean a folder with some classes (.m and .h) files that I imported from CocoaPods. Is there any .a file related to these classes, or am I totally misunderstanding the meaning of library here? I also tried to simply drag the classes without using cocoaPods, same issue.Nubble
C
46

Apparently, your class "Format" is involved in the problem. Check your declaration of this class, especially if you did it inside another class you probably forgot the @implementation or something similar.

Chintz answered 25/10, 2014 at 10:49 Comment(7)
Indeed, I had forgotten to declare an @ implementation just below my @ interface Format in WOExerciseListViewController.m I was so focused on this library compatibility topic that I would never have thought about this! ThanksNubble
I was following Apple's Cocoa Tutorial here: developer.apple.com/library/mac/referencelibrary/GettingStarted/…, where you develop an app called TrackMix, and I was getting the same error as the op after adding the files for a Track class. The tutorial says, The files should now be located in your project’s TrackMix group folder. If you look at the files, you’ll see that stub class interface and implementation declarations are provided for you. But that was not the case for me...Unhitch
I had to create both files by hand, and Track.m did not have a stub implementation. After reading your answer, I added @implementation Track and on the next line @end to Track.m, and the error went away. Thanks!Unhitch
It looks like the problem can be avoided at the outset by choosing: File>New>File, then selecting OS X, then Cocoa Class (rather than Objective-C file). That will create both Track.m and Track.h and provide the stubs inside those files.Unhitch
I am facing the same problem and i have checked for @implementation stuff but i can see that all are fine, not able to figure out that how can i fix it? any help will be appreciated.Gravity
I had a little bit different root cause for the similar issue. Somebody messed up the project file and for some architectures, file references were broken. I had to remove the file from the project and add it again.Cocainism
Thanks "especially if you did it inside another class you probably forgot the @implementation or something similar." worked for me. I forget to enter the implementation.Recur
C
44

Check if that file is included in Build Phases -> Compiled Sources

Characteristic answered 11/3, 2015 at 0:20 Comment(2)
This is what did it for me when I got this error in a today extension, trying to use code files that were in the main bundle.Closefisted
Yep, you may had "lost" the file during a merge. In my case it turned out, that the file known throughout the project file by id 2BA85A8D...48CD was referenced while building as 2BA85A8E...48CD. Therefore, the file was visible and navigatable in Xcode, but unavailable when compiling/linking.Leafy
P
20

Make sure the WOExerciseListViewController is a Target Member; that worked for me!

enter image description here

Pointing answered 25/2, 2015 at 14:10 Comment(2)
Oddly this seemed to have worked for me. But first I had to uncheck and then recheck the Target Membership checkbox.Viewer
The file was not checked for a target. It helped. Thanks!Letter
G
4

Yes, I think the library you are using is not compatible with 64 bit version but you can solve the problem -

Just navigate to Build Settings>Architectures & replace $(ARCHS_STANDARD) to $(ARCHS_STANDARD_32_BIT)

So that your xcode build your project with 32 bit supported version.

Groschen answered 14/1, 2015 at 6:49 Comment(1)
I got: iOS 12 does not support 32-bit programsEarnest
T
4

I just had this error when I opened a (quite) old project, created in Xcode 4~ish, in Xcode 6.4. While the linked Frameworks were visible in the Project sidebar, I overlooked that there were no linked libraries in the Target Build Phases tab. Once I fixed that, it compiled fine.

Tressietressure answered 27/8, 2015 at 12:38 Comment(1)
This did it for me, was trying to include 'libTimeSquare.a', from Square's TimesSquare calendar component. For the record, I was trying to integrate it from a Cocoapod entry.Shwa
J
3

It turned out I forgot to write my @implementation part.

Jassy answered 16/6, 2015 at 17:39 Comment(1)
where to update this change ? file name ?Penelopa
A
2

I simply wasn't linking the libraries in the "Link Binary with Libraries" section.

Avraham answered 9/2, 2017 at 8:51 Comment(0)
C
1

I solved the same issue by going to Xcode Build Settings and in Architectures, I changed the Xcode 6.1.1 standard architecture to:-

$(ARCHS_STANDARD_32_BIT)

Calla answered 8/1, 2015 at 12:35 Comment(2)
This is not a valid fix since apple has forced developer to use $ARCHS_STANDARD architecture for 64 bit. Also, $(ARCHS_STANDARD_32_BIT) is longer available.Strep
Agreed! But when you are testing and you don't understand that the bug is actually with 32-bit/64-bit architecture. Using my above answer can save a lot of time in debugging.Calla
C
1

I just had the exact same error, and solved it by restarting xcode.

For me the issue occurred after an svn update, the file in question was added to the projects folder, but it never appeared in xcode(9.3.1) – until I restarted it.

Consortium answered 29/5, 2018 at 9:41 Comment(0)
B
0

Same error when I copied/pasted a class and forgot to rename it in .m file.

Bilabiate answered 8/6, 2015 at 21:12 Comment(0)
G
0

I solved the problem by deleting reference to the file and adding it again in project. In my case it works.

Grassy answered 18/6, 2017 at 17:54 Comment(0)
D
-2

this setting worked for me:

  • Architectures=$(ARCHS_STANDARD_32_BIT)
  • Build Active Architecture Only:YES
  • Valid Architectures armv6 armv7 armv7s arm64
Degree answered 13/5, 2015 at 13:32 Comment(0)
G
-3

Delete the $(ARCHS_STANDARD) and add the $(ARCHS_STANDARD_32_BIT).

enter image description here

Grundy answered 20/12, 2015 at 0:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.