简体   繁体   中英

Xcode - Missing Architecture (library linking)

For the recent couple of days I have had this compiler error in Xcode every time I've built my project:

ld: warning: ignoring file /.../(Framework Name).framework/(Framework), missing required architecture x86_64 in file /.../(Framework Name).framework/(Framework) (2 slices)

Undefined symbols for architecture x86_64:

  "_OBJC_CLASS_$_CLSNAME", referenced from:

      objc-class-ref in ViewController.o

ld: symbol(s) not found for architecture x86_64

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

I also can't run this code on the iPhone 5 simulator (i386). The iPhone device I have is outdated and can't run iOS 8. I tried setting the build settings to iOS 7 but I get an error regarding the lack of support for dynamic libraries before iOS 8.

Things to note:

  • I am using 2 projects, in 2 different workspaces. (one for the library and one for the demo app. Tests of the same code with the unit tests in the library project are successful.)
  • I used to be able to link the demo project with the library project until I had to do some changes in the library code. After I exported the newer version this error started occurring.
  • In order to get the library file/folder (.framework) I used the Archive option.
  • Running lipo -info outputs Architectures in the fat file: lib.a armv7 arm64
  • I have C++ code in the library project (unlikely to be the issue)
  • In the library project, I am using another external library I installed with Cocoa Pods (also used to work before changes in the library code)

Solutions I tried:

  • Changing the Architectures and the Valid Architectures list in Build Settings.
  • Setting "Build Active Architecture Only" to "No" in Build Settings.
  • Creating a new project (both for the demo and the library)
  • Making the library a static library (new project, got the same warning, no error, couldn't #import the files I needed)

I only started working with iOS and Xcode a couple of months ago and I am not super-experienced with everything there yet, so please try to explain everything with as much detail as you can.

Thanks in advance to anyone trying to help :)

Did you add the framework it says is missing? Also, try to delete the Derived Data folder and then clean the project. If that does not work, then turn off Modules in build settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM