You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cppclean B.hpp
B.hpp:1: 'A.hpp' does not need to be #included; use a forward declaration instead
However if I replace #include "A.cpp" with class A;, it doesn't compile anymore:
$ gcc B.hpp
B.hpp: In member function'intB::getAValue()':B.hpp:6:30: error: invalid use of incomplete type 'class A' int getAValue() { return mA->value(); } ^B.hpp:2:7: note: forward declaration of 'class A' class A; ^
The text was updated successfully, but these errors were encountered:
I have the following include files:
A.hpp
B.hpp
And here is what cppclean tells me:
However if I replace
#include "A.cpp"
withclass A;
, it doesn't compile anymore:The text was updated successfully, but these errors were encountered: