I knew early on that learning C++ wouldn’t be easy, it’s been slow but I think progress has been made, I haven’t learned much in the way of games development but I feel I’ve started in the right place.
This week started with a simple “Hello world” program, this required the console to output text. Which was fine but I had two books (both listed in report 1). They both showed me slightly different ways of writing the first program (one included receiving input and printing the input to screen).
I started with the greater challenge but ended up utilising both books to get the program working, considering this was step 1 I ran into more problems than expected. Firstly, the header file used in my resources was custom, when I used the same one I received errors. So I figured out what I needed to include in the file myself. This was challenging since I had no experience whatsoever with C++ but using both books and a little bit of trial and error I managed to figure it out.
The second problem arose when building the program into a standalone executable. I got an exe in no time at all but the problem was every time I moved the program to a computer with no visual studio installed, it wouldn’t load and I’d receive errors similar to this:
The book does cover this (as I found later) but I ended up doing some research and discovered this can be fixed with a process called linking. The problem was with script dependency and the program not having access to files it needs. The fix was easy, it required simply changing the runtime library in the projects properties.
After these hurdles I managed to move forward with ease, I progressed by reading through chapter 3 in my book covering objects, types, and values. This included creating a project that took two words as input and compared them, took a number and printed some math & some commands that reads the text typed and alerts the user of duplicate words. It’s only simple console applications but I think it’s a great start in learning how to use C++. I’ve provided an image of it in action, there’s not much interesting to look at but the functionality’s there:
This early on my learning seemed quite tedious because I was learning practices and rules I already knew due to my previous programming knowledge. For example, if statements, variables and operators (++, *= etc.) are all things I’d used previously in C#. Admittedly there’s differences and new things to learn, like how types, variables and values are stored in computer memory (bytes) or type safety (converting from one type to another) which was covered in this chapter.
Next week I’m working through my other book focused more on games development. This includes building game-like projects, I’m hoping I’ll find this more enjoyable even if It requires starting simple.