C++ error: field has incomplete type 'int []'

后端 未结 1 1135
星月不相逢
星月不相逢 2021-01-06 12:05

I\'m making a virtual machine in C++ and I\'ve run into this error,

error: field has incomplete type \'int []\' int instrarr[];

I have a

相关标签:
1条回答
  • It's pretty simple, int[] is an incomplete type, as it lacks information about how large it is. In function call parameters, it goes synonymous with declaring a pointer instead of an array, but for defintions, as in your code, the compiler certainly needs to know how large the array is, in order to allocate storage for it.

    0 讨论(0)
提交回复
热议问题