Possible Duplicate:
obj-c duplicate symbol for header variable
I have multiple .m and .mm files in my project. I can include this .h file (that dosent have a corresponding .m or .mm file) in as many .m files as I like but when I include it in more than one .mm file I get the duplicate symbols linker error.
Also in the .h file I have surrounded the content with preprocessor commands (Are these respected in obj-c?) here is what it mostly looks like:
#ifndef _CONFIG_H_
#define _CONGIF_H_
CGFloat WIDTH, HEIGHT;
// other similar code...
#endif
I get the duplicate symbols error on WIDTH and HEIGHT
You should add
keyword before CGFloat declaration in the header, and define the variables without extern in the .m file to avoid defining your variables in multiple places.
In the header:
In a .m file (one of them, any one)