Which .hpp file? The only hpp file you seem to reference is utility.hpp. But you #include utility.hpp within materia.h before you define the Corso class.
Logically, you're running into a circular dependency because materia.h depends on utility.h, but utility.h depends on materia.h. At least, that is my guess based on the provided information.
At first i think it too, but inside .hpp file i use in this way also other class that don't make any errors.
Is it better don't make this kind of "circular dependency" beetween class and header files?
#ifndef CORSO_HPP
#define CORSO_HPP
#include "Utility.hpp"
class Corso { };
#endif
main.cpp
1 2 3 4 5 6
#include "Utility.hpp"
int main()
{
make_db_corso<int>();
}
#including something is essentially just a copy-paste mechanism. So main.cpp navigates into Utility.hpp, which then navigates into Corso.hpp, which then navigates into Utility.hpp, when then attempts to navigate into Corso.hpp, but now there are header guard preventing the infinite cycle, but here it sees "Corso x;" in Utility before it knows the definition of Corso.hpp
The only reason this works is because there isn't a true circular dependency, because Corso doesn't actually need to #include Utility. So if there were a true circular dependency, the code wouldn't be able to compile.
Yes, i've include the #ifndef UTILITY_HPP #define UTILITY_HPP.
But you 'are right, now i commented the "get_chiavi_nodi( radice, &tmp );" inside materia.cpp (in fact the only reason why i need the "utility.h" file ) and the "#include "utility.hpp" inside materia.h and it compiles without any errors.
It's still really strange, i don't understand why with the other class compiler doesn't complains.
Nevermind, i've searching for the dependency with other class but in fact looking again the other functions i don't use any objects or methods of other class, i just forgot to delete the #including of the other class that mayby i had used someway during the writing.
THANK YOU GENADO, for you're fast response and for resolve my problem!