Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_OCMArg"

415 Views Asked by At

I added OCMock version 3.9.1 to my project. The LibPods-* file seems to be linked (checked Target->Build Phases->Link Binary). But during runtime the OCMock framework isn't getting recognized. I also tried to manually link the libOCMock.a file, but no luck. Been stuck with this issue for a while. The OCMock.a file is also present in the build directory of Derived Data, how do I link them correctly. Always let the error

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_OCMArg",

EDIT : I found my problem. Inside the intermediate build folder ../Build/Products/Debug-iphonesimulate, OCMcck generates a folder and libOCMock.a sits inside it. My project while building has no access to that lib. If I manually move the file libOCMock.a one level down to the folder Debug-iphonesimulate, everything works as expected. Now how do I change my xcode settings to make my project look into folders recursively in the Build directory?

1

There are 1 best solutions below

4
sanjirambo On

Without some code, there isn’t much we can do to help. OCMock has been around for the past 10yrs and it supports x86_64 architecture. I suspect the issue might lie in pods. Try to clean install pods in your project and delete the derived data and build again.

For a temporary work around you can try to remove x86_64 from your Valid Architectures under Build settings in Xcode. Then you can try to run the project on an iPhone.