since i have had prior programmingsment experience, when watching the tutorials i like to try and code a bit ahead
however, for example when I did the snek game i ran into problems, and google told me it was about a file including a file, which includes itself and the compiler errors so it doesnt go into an ant circle of death
ive just been trying to #include things in the files when i want the certain files but sometimes it fucks up
how 2 not fuckup the includes
how to not fuck up #includes and sgit
Re: how to not fuck up #includes and sgit
If there is a loop (for example, I included Dude.h in Game.h and vise versa once) it won't work.
If it's a file that is included multiple times (f. ex graphics in Dude and Game, which includes dude) you can use "#pragma once "
in the header files.
If it's a file that is included multiple times (f. ex graphics in Dude and Game, which includes dude) you can use "#pragma once "
in the header files.
Re: how to not fuck up #includes and sgit
Yo holm, nice job googling that shit and getting an idea for yourself. For the snek game, write your code that that there are no depencency cycles. I.e. game knows about board, snake, segment, snake knows about board and segment, segment knows about board, and board don't know about shit (except location, which everybody knows). So segment doesn't know what a snake is, and snake doesn't know what game is, etc. etc.
Later on, in tutorial 18 (i think), i teach you the actualy mechanism of why #include cycles fuck you up, and then in a later tutorial (21 or 22) I teach you a way around that, when you really need two things to know about each other.
Later on, in tutorial 18 (i think), i teach you the actualy mechanism of why #include cycles fuck you up, and then in a later tutorial (21 or 22) I teach you a way around that, when you really need two things to know about each other.
Chili