So I have a project with multiple files of course.. many headers which include other headers, which is causing "multiple definitions of" errors (I know thats the cause) .. I have 'ifndef' on all the headers and I'm not including any .cpp files, and I've done extensive testing.
Basicly I have objects of a class that is required in most of my .cpp files, but I cant put those in a header to include to them or it will give me that error. I cant include a .cpp with the objects because that gives me an error too. I'm kinda stuck here.. I cant define the objects like you do with ints and such.
So the int is fine.. that works, but the class objects there will work but will return an error with multiple files (and the brackets dont matter so thats not it).Code:###### example.h #ifndef _EXAMPLE_H_ #define _EXAMPLE_H_ int problem; FruitClass RedFruit(); // error FruitClass GreenFruit(); // error #endif // _EXAMPLE_H_ ###### example.cpp problem = 5;
Anyone mind lending me ideas?
Thanks in advance,