Westley
Westley

Reputation: 1153

How do I fix this duplicate symbol error?

From the error I am getting:

ld: duplicate symbol _main in /Users/wostler/Library/Developer/Xcode/DerivedData/UIPageViewControllerDemo-hjsgatcuhsxeokdnubifybpivzum/Build/Intermediates/UIPageViewControllerDemo.build/Debug-iphonesimulator/UIPageViewControllerDemo.build/Objects-normal/i386/fmdb.o and /Users/wostler/Library/Developer/Xcode/DerivedData/UIPageViewControllerDemo-hjsgatcuhsxeokdnubifybpivzum/Build/Intermediates/UIPageViewControllerDemo.build/Debug-iphonesimulator/UIPageViewControllerDemo.build/Objects-normal/i386/main.o for architecture i386

I can't figure out why this error is occurring. I simply changed some framework files in my project and now this error won't go away! It obviously says _main is being duplicated, but I dont know where, or why?

What is causing this?

Upvotes: 4

Views: 6612

Answers (3)

fannheyward
fannheyward

Reputation: 19277

Sounds like you have multiple entries under Targets/Compiled Sources. Check and remove them.

Upvotes: 3

drekka
drekka

Reputation: 21883

You need to look at the main.m/.h and fmdb.m/.h files. What is most likely is that they are both importing something that defines _main, perhaps at a global level. Usually thats the sort of thing that generates this error for me.

Upvotes: 8

Bryan Chen
Bryan Chen

Reputation: 46598

You have two main function in your code. Do a global search for main and remove the one you don't want.

It happens when you add some other project's files to your project without remove the main function.

Upvotes: 4

Related Questions