Sunday, October 3, 2010

Include guards!!

So in my previous post, I was having trouble with including multiple header files in my main.cpp. I searched Google for hours, and I stumbled upon include guards. These are used in header fines just to avoid that header file being included twice. When I first read about these include guards, I didn't really understand them but just started putting them on every file in my project. After that didn't work, I resorted back to Google, and kept stumbling upon include guards. This time I took my time to actually read what they were. You only put them in the header files, and only guard the header file you're putting them in. Once my project was able to build and execute successfully I felt like jumping up and down!... but then it wasn't drawing my "bullet" sprites when I pressed space bar. Actually, when I did press space bar the program crashed =(. So the bullets are my new obstacle.

Everytime I get stuck on something like these include guards, I feel like quitting, but after seeing that little triangle move when I pressed the arrow buttons, I felt motivated again.

No comments:

Post a Comment