There's no source file...? That sounds like your problem, unless you're linking in a library or something. The linker is complaining that the header you're including has a constructor and destructor defined but it can't find the source for them.
i.e. you declared FE_Iterator and FE_State constructors and destructors but you don't have a definition of them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class FE_Iterator {
public:
FE_Iterator(){//write the definition here (if any)}
~FE_Iterator(){//write the definition here (if any)}
};
class FE_State {
public:
//consider putting these 2 as private members
int state;
FE_Iterator *iter;
//provide a definition of these 2 within curly brackets {}
FE_State();
~FE_State();
};
I cannot find the foreach.cpp file after searching google code, a sourceForge library, and asking someone that should have it - I agree that there must be one. Can the definition be guessed based on the header file and standard constructors and destructors? I looked at lexicon and iterator files but don't know enough to modify their code for the foreach. But it should be a couple lines at most.
I see, so this header file is incomplete not that the source file is missing. I looked at versions of the foreach.h file from different sources and they are the same - I can recheck. If I understand you correctly, the foreach.h file is missing the definitions.
Template definitions must be in a header, but non-template classes can be in source files. Though, I don't see the corresponding definitions of FE_Iterator. These definitions, however, can appear in a source file.