Andy
Andy

Reputation: 195

Error "_OBJC_CLASS_$_AppDelegate", referenced from:" and error: linker command failed with exit code 1 (use -v to see invocation)"

I'm pretty new to developing, and i got this error, I'm not shire if i got something missing in my AppDelegate files so I'm gonna show you the files.

the h-file

#import <UIKit/UIKit.h>


@interface AppDelegate: UIResponder <UIApplicationDelegate>


@property (strong, nonatomic)  UIWindow *window;

@end

the m-file

#import "AppDelegate.h"

the thing is that i think i removed something from te m-file but i can't remember what it was

here is the full error message:

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

Upvotes: 15

Views: 18003

Answers (2)

Jayesh Chawla
Jayesh Chawla

Reputation: 1

If your file (AppDelegate.mm) is missing in XCode, you should find the file in your iOS project via Finder and drag that file into your XCode:

enter image description here

enter image description here

Upvotes: 0

GenieWanted
GenieWanted

Reputation: 4513

You will need to make sure that your AppDelegate.m is added under Compile Sources in your target settings.

To do this, click on the project (left upper on your Xcode window) -> Click on Build Phases tab -> Compile Sources and then check to see whether AppDelegate.m is actually added to the list. If not, click + button -> Type AppDelegate.m -> Select and then Add it. That should do.

Upvotes: 36

Related Questions