C:\Documents and Settings\XAN DIET VINIE\My Documents\XANDER\Programmeren\Papa Poulefase\vul_struct.cpp|8|error: variable or field 'vul_struct' declared void|
C:\Documents and Settings\XAN DIET VINIE\My Documents\XANDER\Programmeren\Papa Poulefase\vul_struct.cpp|8|error: 'TEAM' was not declared in this scope|
C:\Documents and Settings\XAN DIET VINIE\My Documents\XANDER\Programmeren\Papa Poulefase\vul_struct.cpp|8|error: 'temp' was not declared in this scope|
C:\Documents and Settings\XAN DIET VINIE\My Documents\XANDER\Programmeren\Papa Poulefase\vul_struct.cpp|8|error: expected primary-expression before 'int'|
||=== Build finished: 4 errors, 0 warnings ===|
Unfortunately that doesn't help the compiler when it is compiling vul_struct.cpp. You need to put that declaration of TEAM into its own header file and include it in vul_struct.cpp and in main.cpp
The rule is that the compiler has to see the declaration of the struct before it compiles something that uses it. That means that if several different .cpp files use the struct then they each need to #include its declaration so the compiler knows what's going on.
It's NOT only with structures. It's because you defined what TEAM was after the compiler had seen it used in the other files. Declaring it beforehand would fix it.
Ok, and structures aren't then...
Now I come to think of it, if i use it in one .cpp file, I wouldn't need to make a separate header for it?
And, why would you take several .cpps ? Just a question, what is the good thing about several cpp?
Classes, structures, and unions are all fundamental data structures. BUT, the data types you declare with them only exist AFTER you declare them, and not everywhere. This is the same for variables and just about everything.
You define int x before you use it. If you tried to use your int x in vul_struct.cpp then you would have to declare it just like you have to declare TEAM.