So I tried to define a struct in its own .cpp file (for organization or whatever) and I forward declared it in a header, included the header in the .cpp file, then included the header in main.cpp and tried to create a vector of the struct, and it did not work. However I then took the definition of the struct and put it into main.cpp and it did work. Is this just a quirk of structs that I was unaware of, that they need to be defined in the file that they are used (for some reason)? Here was the code:
//people.h
struct People;
//people.cpp
#include people.h
struct People
{
std::string name;
int age;
};
//main.cpp
#include"people.h"
#include<vector>
std::vector<People> list;