0
與其他許多'x'不同,這裏沒有命名類型錯誤,我不認爲這涉及循環依賴,但我仍然無法計算出來。另一個「x」沒有命名類型錯誤
typedef struct /* structure definitions */
{
float mat[4][4];
} matrix_unit;
matrix_unit I = {
{ 1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1 },
};
matrix_unit *stack[50]; /* (line 456) array of pointers to act as a stack */
matrix_unit stackbase = I;
stack[0] = &stackbase; // 'stack' does not name a type
由於堆棧已經被聲明爲一堆指向matrix_unit結構體的指針,這不應該是有效的嗎?
當我編譯「GCC -c 3D.c」的代碼,我從這些線得到以下錯誤:
3D.c:457:1: error: initializer element is not constant
3D.c:458:1: warning: data definition has no type or storage class
3D.c:458:1: error: conflicting types for ‘stack’
3D.c:456:14: note: previous declaration of ‘stack’ was here
3D.c:458:1: error: invalid initializer
在此先感謝您的幫助。
用gcc編譯好4.6.2 – grifos 2012-03-27 02:22:16
嗯..嗯,我包括一個C++文件。應該有什麼影響?我用g ++編譯它 – Richard 2012-03-27 02:28:14
也用g ++ 4.6.2編譯。所以這不是這個子集的編譯器問題。不過,我只能測試你在帖子中寫的內容。 – grifos 2012-03-27 02:31:27