Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redefinition of typedef is a C11 feature

I'm trying to create a header file as such:

#import <UIKit/UIKit.h>

typedef void (^RevealBlock)();

@interface BFTasksViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate> {
@private
    RevealBlock _revealBlock;
}

- (id)initWithTitle:(NSString *)title withRevealBlock:(RevealBlock)revealBlock;

@end

But I get this warning:

Redefinition of typedef 'RevealBlock' is a C11 feature

Is this something to be worried about? I'm looking at the GHSidebarNav project, which seems to use it just fine.

like image 462
joslinm Avatar asked Sep 10 '12 20:09

joslinm


2 Answers

You must have declared RevealBlock somewhere else, as i don't see any import other than UIKit/UIKit.h, check you project .pch file for conflicting headers (or could it be that you removed some headers to make the snippet shorter ?).

like image 102
A-Live Avatar answered Sep 24 '22 07:09

A-Live


Is this something to be worried about?

If you are compiling a C or ObjC program and the compiler does not support C11, then the compiler should reject the program (GCC 4.2-Apple/LLVM as an example you or somebody using your program may be using). Note that C++ has supported multiple definitions for many years.

Of course, these definitions which appear in multiple files must always match where you use them as the same type. Otherwise, the compiler may set the parameters up incorrectly before the call is made.

like image 21
justin Avatar answered Sep 23 '22 07:09

justin