0
我使用矢量操縱和引力常量創建重力模擬器。 我已經定義了2個結構體。重力模擬器,碰撞檢測,矢量
typedef struct {
double vector[3];
} Vector;
typedef struct {
Vector colour;
double mass;
double radius;
Vector position;
Vector velocity;
Vector accel;
} Object;
我有很多矢量運算功能,包括:
Vector VectorUnit(Vector a) {
Vector b;
int i;
for (i = 0; i < VECTOR_DIM; i++)
b.vector[i] = (a.vector[i])/(VectorMag(a));
return (b);
}
當我運行函數的內部,它編譯罰款。儘管當使用我它聲稱爲「衝突的類型」的錯誤的任何載體量..
GRAV.c:463:8: error: conflicting types for ‘VectorUnit’
Vector VectorUnit(Vector a)
^
GRAV.c:341:3: note: previous implicit declaration of ‘VectorUnit’ was here
VectorUnit(bodies[j].position);
是否與一個函數調用諸如VectorUnit具有什麼問題(體顯式調用函數VectorUnit()[j]的.POSITION ); 如上所述,使用我的函數的內部完美編譯..
我宣佈他們除了這一個!謝謝 – 2014-10-30 00:58:44