I have a header file, let's call it SomeClass.h in which a class is defined as usual:
class SomeClass {
...
};
The implementation of SomeClass is in another file, say SomeClass.cpp.
Then I have another header file, say AnotherClass.h which tries to use the SomeClass class to define another class, as shown below.
#include <SomeClass.h>
class AnotherClass {
...
protected:
std::unique_ptr<SomeClass> s; // (*)
};
when I try to compile, I get the following error:
error: 'SomeClass' was not declared in this scope
but this is quite surprising, since CLion is not detecting this error and when I click on SomeClass in the instruction commented with // (*) above, CLion correctly goes to the definition of SomeClass in SomeClass.h
So the question is:
why is CLion seeing SomeClass while the compiler is not seeing it?