iOS编译报错 "_OBJC_CLASS_$_Test", referenced from:objc-class-ref in ViewController.o

先贴一下错误:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_Test", 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)

1、新建工程引入Test这个类,首先targets不勾选


iOS编译报错
61B31274-C472-48B5-8FB1-12ECB6A4A2BD.png

然后在viewController里面创建这个Test对象

iOS编译报错
Paste_Image.png

此时编译就会报这个错误


iOS编译报错
1FDDBB91-3886-47BE-A703-E452F7A2AD49.png

解决:


iOS编译报错
29AD4C9A-02FD-4685-9F6C-E4D125BE8758.png
iOS编译报错
Paste_Image.png

因为在编译过程中,compile sources不存在这个类,所以会报错,
此时再次编译一下OK

你可能感兴趣的:(iOS编译报错 "_OBJC_CLASS_$_Test", referenced from:objc-class-ref in ViewController.o)