Xcode, Duplicate symbol _main

前端 未结 10 877
抹茶落季
抹茶落季 2020-11-30 03:14

I have duplicate symbol _main.

The problem is it says \"Duplicate symbol _main in /Users/.../i386/main-B9843B6026D6EFA4.o and /Users/.../i386/main-B9843B6026D6EFA4.o

10条回答
  •  佛祖请我去吃肉
    2020-11-30 03:40

    In my case, I declared an NSString in my constants file (imported by many classes) but forgot to define it as static!!

    e.g. NSString* PARAMS = @"paramA"; should be: static NSString* PARAMS = @"paramA";

    Reading the full error message allowed me to figure this out: "Duplicate symbol PARAMS". Don't be afraid and try to understand error messages! Sometimes they might even tell you exactly what you did wrong.

提交回复
热议问题