tags:

views:

26

answers:

1

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?

+1  A: 

You have to put the definition into the implementation (.m) file. If you want to remove the symbol a from another implementation file, you have to remove the static and put a declaration

extern NSString* a;

in your header.

Nikolai Ruhe
I did as u said but it gives a is initialized and declare extern
I don't understand your comment. You have to write `NSString* a = @"HARDIk";` in the .m file in global scope (not in a function).
Nikolai Ruhe
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 usedhow to remove this warning.is any solution for this warning?
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.
Nikolai Ruhe