ANA
ANA

Reputation: 280

Apple Mach-O linker Error Xcode 6.2

I'm sorry if this question is a duplicate, but I only asked it because I didn't find a solution in other related questions.

I started a new project in Xcode 6.2 and I imported AFNetworking using pods. I also imported SWRevealViewController by dragging the two files (.h and .m) into the project.

Everything looks fine but when I build the project to test it gives me the error below.

Error Screenshot

Does anyone know how to deal with this?

Upvotes: 0

Views: 269

Answers (1)

trojanfoe
trojanfoe

Reputation: 122449

You have the same symbols jsonContents, dictionary, etc in 2 object files (ArticlesViewController.o and MainViewController.o).

This often happens when you import a header file that defines the symbols, for example:

SomeHeader.h

NSMutableArray *jsonContents;
NSMutableDictionary *dictionary;

Rather than declaring them as extern:

SomeHeader.h

extern NSMutableArray *jsonContents;
extern NSMutableDictionary *dictionary;

and define those variables in their own implementation file (SomeFile.m for example).

Upvotes: 3

Related Questions