You cannot define a variable of an incomplete type. You need to bring the whole definition of Cat
into scope before you can create the local variable in main
. I recommend that you move the definition of the type Cat
to a header and include it from the translation unit that has main
.