Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot combine with previous 'type-name' declaration specifier

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 this error?

#import "SalesAPIManager.h"

@interface SalesDelegate : NSObject { // error points to this line
    __unsafe_unretained id<SalesAPIManagerDelegate> delegate_;
}


@property (unsafe_unretained, nonatomic) id<SalesAPIManagerDelegate> delegate;


- (id)initWithDelegate:(id<SalesAPIManagerDelegate>)delegate;


@end
like image 346
pshah Avatar asked May 02 '12 18:05

pshah


4 Answers

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.

like image 137
Chris Mitchelmore Avatar answered Oct 19 '22 18:10

Chris Mitchelmore


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.

like image 37
javaProgrammer Avatar answered Sep 24 '22 05:09

javaProgrammer


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.

like image 5
Abo3atef Avatar answered Oct 19 '22 18:10

Abo3atef


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.

like image 3
Dan Avatar answered Oct 19 '22 18:10

Dan