Hello, I am learning c++ from 'learning c++ by creating games with ue4'. And in one of the solutions i seems to be getting errors and i do not understand why as i have copied exactly what is says in the book. The first code given below is the code given from the book, the second one code that i have added some stuff to, to try and fix the vector problem. can someone please help me thanks
There are just a couple things missing or slightly misplaced here.
First thing is first- these two sections of code can't be in the same file. You're only allowed one main().
Second, you haven't declared the "vector" class from the first example. I imagine it is something simple like this:
1 2 3
struct vector{
int x,y,z;
}
Third, me.position = me.position.x is invalid. Take out the me.position = in the front of that line.
You haven't declared system. There is a sticky somewhere on the forum talking about that particular function, but I won't get into it here. To use system #include <stdlib.h>
The second example has the additional problem of having struct player followed immediately by struct vector. You'll want to remove one of those (vector more than likely)
So they code the book gives is as follows; (sorry that it is not in the proper format, I am new here and not sure how to get it to the correct format when giving a reply)
#include <iostream>
#include <string>
using namespace std;
So the book is wrong? I have tried to fix with the solutions in the answers and still having some problems, but i will mess around more and see if i can fix it