Including logic

I added the #include “Mover.h” right bellow the other includes are and that gave an error, putting it in the same place as shown in the video works. What is the logic when including ? why can’t you just put them in any order you can ?

C++ has to know about the class you want to use before you can reference it or use it in a parameter. The include file has the bits the compiler needs to know about the class so it can ensure it is being used correctly.

I’m not sure why this is the case, but I do know that it has to do with the generated.h file in particular: that needs to be at the bottom. Other than that, the other #includes can be in any order.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms