Itzik984
Itzik984

Reputation: 16794

Undefined symbols for architecture x86_64 error on xcode

I have a simple project, on my basic ViewController.m i'm trying to move to another UIViewController by doing:

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
...
}

- (void)addAlarmBrick {
NewAlarmViewController *navc = [[NewAlarmViewController alloc] init];
[self presentViewController:navc animated:YES completion:nil];
}

I have the NewAlarmViewController on my project with the .m file listed in the target membership.

This is the full error message:

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

what am i doing wrong over here?

EDIT:

Adding the settings for both files:

.m file:

.m

.h file:

enter image description here

Upvotes: 0

Views: 2205

Answers (4)

Itzik984
Itzik984

Reputation: 16794

Well, It turns out the error was not adding the following to the relevant file:

@implementation NewAlarmViewController


@end

I don't know why the @implementation must be added, but it must be.

Upvotes: 1

bhr
bhr

Reputation: 2337

Maybe Xcode messed sth up. Did you already try removing NewAlarmViewController from the project and readding it again? -> Select .h and .m file, press delete, remove reference, and then drag them again into your project.

Also clean the build folder (cmd + alt + shift + k) and rebuild your project.

Upvotes: 0

Duncan C
Duncan C

Reputation: 131481

It sounds like you might have a library included in your project that is only compiled for ARM, and doesn't provide object code to run on the simulator. Did you include any third party libraries in your project? (Or is NewAlarmViewController from a third party library?)

Upvotes: 0

Vamshi Krishna
Vamshi Krishna

Reputation: 989

Go to All settings, select your project and check for Architecture and compiler for c/c++/obj c under build options as shown in the screenshot.

Upvotes: 0

Related Questions