kvarnerexpress 0 Report post Posted June 14, 2005 I'm using Dev-C++ as a compiler.(To use a classroom assignment as an example,) here is my problem...I've got classes Dog and Cat, which inherit from class Animal, (which uses iostream, stdlib, and some classes created by students) When I include both Dog and Cat in a new file, I get errors because I'm including libraries twice. (iostream included from Dog, and from Cat...)I can get around the problem by having Dog inherit Animal, and Cat inherit Dog (which sounds pretty idiotic, I know..I was just testing to see if the problem was really what I thought it was...) This is all on a PC at school, and I'm out for the summer, so I can't include the specific code...Please post if I'm not explaining myself well enough. Thanks! Share this post Link to post Share on other sites
dexter 0 Report post Posted June 15, 2005 I always include whatever libraries are necessary for the class/file to compile fine without depending on other custom files.So, anything that might need the iostream header, will have it included...My only thought is that you haven't included the ifndef around the classes:#ifndef DOG_H#define DOG_H#include <iostream>#include "animal.h"class Dog : public Animal {};#endifI just did a test dummy up, and it worked fine. This is all on a PC at school, and I'm out for the summer, so I can't include the specific code...Please post if I'm not explaining myself well enough. You know, it's not really that hard to bump up a test case to recreate the problem. Share this post Link to post Share on other sites