cannot combine with previous 'type-name' declaration specifier

前端 未结 6 514
暖寄归人
暖寄归人 2021-01-17 12:23

My iOS app was working and all of a sudden I\'m seeing this error: \"cannot combine with previous \'type-name\' declaration specifier\". Any ideas on what could be causing t

相关标签:
6条回答
  • 2021-01-17 12:49

    Likewise I had a typo in a random file in the project. It was just some plain text that was accidentally placed before a comment. My suggestion to fix/find it would be to put a ; just before the statement that is flagged. This then drew a warning to the errant text when I compiled.

    0 讨论(0)
  • 2021-01-17 12:51

    I saw this error when there was some dead incomplete code in my file that I'd forgotten to take out. The compiler indicated the error at the start of a method at the return type, so I spent a lot of time looking at the method declaration and call. Turned out the incorrect typo was above the method. since there was no ";" the compiler could only tell that the void keyword was misplaced.

    0 讨论(0)
  • 2021-01-17 12:53

    I had this same problem. It turns out I had a typo in my main.m file. Once I cleared that up, this error went away.

    0 讨论(0)
  • 2021-01-17 12:54

    I get the same problem. And I finally fix it after cleaning some junk text at the bottom of my .h file. you may try.

    0 讨论(0)
  • 2021-01-17 12:54

    I got it in a header file when in fact the error was in the .cpp. Turns out I had a method trying to return a bool in a sketchy way:

    return (x == 1 && y == 2);
    

    Which it turns out doesn't work, but Xcode told me in this very obscure way.

    Not sure if this helps, but it's another example in a seeming desert of them.

    0 讨论(0)
  • 2021-01-17 13:05

    It's one of the disadvantages of Xcode. Xcode is one of the worst IDE's ever, Apple is trying to make it better every update. But this issue raises when you add "Some word" in some places that the compiler of Xcode is not looking at it.

    My case was like in image :

    enter image description here

    I forgot to delete the word RESideMenu in AppDelegate.h and the strange thing that Xcode accepts the code until the Build and when it fires error it rays it in another and not related class.

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