C++, how to declare a struct in a header file

后端 未结 7 1497
暖寄归人
暖寄归人 2021-01-30 14:40

I\'ve been trying to include a structure called \"student\" in a student.h file, but I\'m not quite sure how to do it.

My student.h file code c

7条回答
  •  后悔当初
    2021-01-30 15:02

    You've only got a forward declaration for student in the header file; you need to place the struct declaration in the header file, not the .cpp. The method definitions will be in the .cpp (assuming you have any).

提交回复
热议问题