Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 343
Westley Avatar asked Dec 07 '22 16:12

Westley


2 Answers

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.

like image 135
drekka Avatar answered Dec 20 '22 13:12

drekka


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.

like image 42
Bryan Chen Avatar answered Dec 20 '22 12:12

Bryan Chen