5 years, 2 months ago.

Why is the order of includes making a difference ...

For the first time I created a class with base classes (i.e. class X : Baseclass1, Baseclass2)

I have a library of frequently used sources. The library contains a bunch of .cpp and .h files that have "included" ok up to this point.

When I put my new class with base classes into the library (the .cpp and .h files) I get a compile failure. If I move the new class's include file to the source where the class is being used (not in the library) then it compiles and the program runs correctly.

The error message is "not a class declaration" and the line it is complaining about is the class declaration in the .h file.

All .h files have the "ifdef ... define ... endif" guards to prevent duplicate inclusions.

Be the first to answer this question.