I declared a struct within the same .cpp file of the main() function. Then no error occurs.
But the error of "incomplete type is not allowed" occurs if I put the struct in another .cpp file.
file2.cpp:
struct a_point {
float x, y;
};
file2.h :
struct a_point;
file1.cpp :
#include "file2.h"
int main(){
a_point pnt_arr[5]; // error occurs, in visual studio 2017
return 0;
}
Aucun commentaire:
Enregistrer un commentaire