error C2065: 'mainchar_values' : undeclared identifier
error C2065: 'player' : undeclared identifier
error C2065: 'background' : undeclared identifier
error C2275: 'background_values' : illegal use of this type as an expression
: see declaration of 'background_values'
error C2062: type 'float' unexpected
The file that the error occurs in.
Screen_Manager.h
I have tried defining other functions with struct mainchar_values as parameters in Screen_Manager.h and it seems that, that is the only one that causes an error.
I am also able to create instances of struct mainchar_values in my main class.
I see that on line 34 in struct background_values you declare what looks like a function. It may be complaining that there is no return type, and in addition to your declaration in your header file the compiler is expecting a function definition.
Assuming background_values has a void return type, I'd try putting this into your Screen_Manager.cpp implementation file:
Actually that's the constructor that I have for background values, which I do have a definition for in the cpp file. If I comment out that function where the error occurs everything else runs smoothly, its just when I try to put mainchar_values as a parameter that things goof up.
You haven't declared your mainchar_values class before the my_val_to_bv_val function. It probably screwed over the other parameter declarations since the compiler couldn't deal with the first one.
Thankfully, you're using a pointer for mainchar_values. All you have to do is prototype mainchar_values above somewhere. This is a way to promise your compiler that you've defined this class later on.
Maybe your compiler went through Sprite.h first, which then led it to Screen_Manager.h. In that order, mainchar_values has never been declared yet.
Anyway, you should try to avoid such includes within header files. Prefer prototyping versus including an entire file you may or may not need. This will help you avoid problems like this one.