Я пытался включить структуру, называемую «Студент», в файл Student.h < /code>, но я не совсем уверен, как это сделать. < /p>
my Student.h < /code> Код файла полностью состоит из: < /p>
#include
using namespace std;
struct Student;
< /code>
, в то время как файл Student.cpp < /code> полностью состоит из: < /p>
#include
using namespace std;
struct Student {
string lastName, firstName;
//long list of other strings... just strings though
};
< /code>
К сожалению, файлы, которые используют #include "study.h" < /code> представляют многочисленные ошибки, такие как < /p>
error C2027: use of undefined type 'Student'
error C2079: 'newStudent' uses undefined struct 'Student' (where newStudent is a function with a `Student` parameter)
error C2228: left of '.lastName' must have class/struct/union
< /code>
Похоже, компилятор (vc ++) не распознает студента Struct из "Student.h"?>
Подробнее здесь: https://stackoverflow.com/questions/273 ... eader-file