duplicate symbols for architecture i386 clang

后端 未结 24 1173
悲哀的现实
悲哀的现实 2020-11-29 20:33

I\'ve seen several posts on google and stackoverflow related to this error, I\'ve read all of them but still fetching the problem , I will be glad for a solution. Here is th

24条回答
  •  春和景丽
    2020-11-29 21:01

    Linker errors are always showing a problem regarding to a library usage or import issues.

    Sometimes the error happens when you have imported a .m file instead of a .h file.

    Please check your code and look for a .m import statement in one of your header files (.h extension), I had a similar issue and 14 duplicate symbol error raised.

    Check if you have imported ViewControler.m instead of its .h,So it has to be this way :

        import "ViewController.h"
    

    and your AppDelegate.h should be something like this :

    import "UIKit/UIKit.h"
    import "ViewController.h"
    @interface AppDelegate : UIResponder 
    @property (strong, nonatomic) UIWindow *window;
    @property (strong,nonatomic) ViewController *mainController;
    @end
    

    Always remember to import header files not a .m

提交回复
热议问题