You seem to be saying that the code you are showing doesn’t actually produce the compiler error that you are having a problem with. So we can only guess. Here are some possibilities:
- You could have forgot to include
problemclass.hfrom the file where you are usingProblemClass. - You could have misspelled the name of
ProblemClasseither in its own header file or in the place where you are using it. This can be hard to spot if it is a capitalization error such as writingProblemclassorproblemClassinstead ofProblemClass. - You could have copy-pasted your inclusion guard
#definesfrom one header file to another and then forgot to change the defined names. Then only the first of those two included header files would take effect. - You could have placed
ProblemClassin a namespaceA, in which case you must refer toProblemClassasA::ProblemClassif you are referring to it from outside the namespaceA. - You may be using templates and not expecting two-phase lookup to work the way it does.
- You could have misspelled the file name in your include. The compiler would not report an error on that if you also have an old version of that file under the misspelled name.
- You could have made
ProblemClassa macro that only gets defined after you includeproblemclass.h, in which case what you see asProblemClassgets replaced by something else by the macro preprocessor. - You could have defined
ProblemClassin a header file other thanproblemclass.hand thenproblemclass.hactually defines something else.