Unknown override specifier, missing type specifier

As @Pete Becker points out in the comments, you need to qualify the name string as std::string: The compiler just doesn’t know what you’re talking about, and it’s the equivalent of just writing: The compiler just doesn’t know what type that is unless you’ve declared, hence the error missing type specifier – int assumed You should read up … Read more

Copy a file in a sane, safe and efficient way

Copy a file in a sane way: This is so simple and intuitive to read it is worth the extra cost. If we were doing it a lot, better to fall back on OS calls to the file system. I am sure boost has a copy file method in its filesystem class. There is a C method … Read more

Read data from a file into an array – C++

The issue is that you’re declaring a local grades array with a size of 1, hiding the global grades array. Not only that, you are now accessing the array beyond the bounds, since the local grades array can only hold 1 item. So get rid of the line: However, it needs to be mentioned that this: is not valid C++ syntax. … Read more

Understanding glm::lookAt()

The up vector is basically a vector defining your world’s “upwards” direction. In almost all normal cases, this will be the vector (0, 1, 0) i.e. towards positive Y. eye is the position of the camera’s viewpoint, and center is where you are looking at (a position). If you want to use a direction vector D instead of a center position, you can simply use eye … Read more

Remove spaces from std::string in C++

The best thing to do is to use the algorithm remove_if and isspace: Now the algorithm itself can’t change the container(only modify the values), so it actually shuffles the values around and returns a pointer to where the end now should be. So we have to call string::erase to actually modify the length of the container: We … Read more