Duplicate Symbol Error

后端 未结 11 1876
情书的邮戳
情书的邮戳 2021-01-18 03:44

I\'m not sure what I did but I added an IBOutlet to display an additional attribute in a TableView cell. When building the application I get the following error message...

相关标签:
11条回答
  • 2021-01-18 04:01

    This can happen when a source is compiled in your target twice, or if it is built in two separate targets. You can verify this in your target's build phases, or remove it from the target and then re-add it.

    Update

    Kasas pointed out a new Xcode feature (in an Edit which other reviewers rejected), where Xcode can detect some such cases for you -- Simply "Validate" the target or project settings. If found, Xcode will offer to remove the redundant compilation for you. Thanks Kasas.

    0 讨论(0)
  • 2021-01-18 04:02

    I had this problem . I solve it.

    Because ı did mistake when ı import to viewcontroller .

    mistake: #import "viewcontroller.m"

    Later I edit : `#import "viewcontroller.h"

    only I changed extension of viewcontroller .

    0 讨论(0)
  • 2021-01-18 04:02

    i had meet same problem, and i solved it. When i copy and paste my view and view controller with different name, i got this error (dublicate sembol in _temp). i solved this error by changing constant name. You can also move your constant between implemantation bracets. My examples code below. And my constant name is temp.

        @implementation MyCombineSaveTableView
    {
        BOOL *pulltoRefResh;
        NSString *currentElement;
        int temp;
        int User_ID;
    }
    
    0 讨论(0)
  • 2021-01-18 04:03

    This may happen also if you have constant definitions with the same name in two different classes. In my case it was a boolean flag like these:

    Class A:

    #import "MyATableViewController.h"
    
    @implementation MyATableViewController
    
    @synthesize someVariable;
    
    BOOL MY_FLAG = YES;
    ...
    

    Class B:

    #import "MyBTableViewController.h"
    
    @implementation MyBTableViewController
    
    @synthesize someVariable;
    
    BOOL MY_FLAG = YES;
    ...
    

    I just had to change the constant definition on the second class to:

    ... BOOL MY_B_FLAG = YES; ...
    
    0 讨论(0)
  • 2021-01-18 04:04

    In my first app, I had this problem after replacing a class. As I didn't want to delete the old class completely, I moved it to another group, still within xcode. xcode tries to compile two copies of this class, causing the error. Deleting the references to the old class from the project fixed my problem.

    Upvote went to quarac, who made this easier for me to spot.

    0 讨论(0)
  • 2021-01-18 04:06

    Not sure, but a silly question - did you do a clean after clearing the old code? Sometimes that stuff hangs around.

    0 讨论(0)
提交回复
热议问题