I'm writing in my code, static const NSString *a = @"HARDIk"; this is in a.h file
now i use this,
a object in any b file I'm getting warning a defined but not used
how to remove this warning?
From stackoverflow
-
You have to put the definition into the implementation (.m) file. If you want to remove the symbol
afrom another implementation file, you have to remove thestaticand put a declarationextern NSString* a;in your header.
: I did as u said but it gives a is initialized and declare externNikolai Ruhe : I don't understand your comment. You have to write `NSString* a = @"HARDIk";` in the .m file in global scope (not in a function).: Sir i have simple question. I have a.h file where i declare static const NSString *variable = @"HARDIk" Now, in b.m file i have function [a funtionname:(NSString*)variable]; i use this operation and it works properly but i get warning difined but not used how to remove this warning. is any solution for this warning?Nikolai Ruhe : As I said in the original answer: replace `static const NSString *variable = @"HARDIk";` with `extern NSString *variable;`. Then write `NSString *variable = @"HARDIk";` in the a.m file.Nikolai Ruhe : You asked 36 questions but accepted none of the answers. Please start to accept (right) answers, otherwise people will stop helping you.
0 comments:
Post a Comment