早上好SO-這種那些被烹煮給我的麪條了一下(也,這是非常困難google一下C語言編程,我注意到...)調用的對象不是函數c
void prepareFrames(PDouble prep){
int gap = prep->gap;
printf("Gap is %d\n", gap);
prep->intFrames = (PFrame*)malloc(gap*sizeof(PFrame));
PFrame copyFrame = prep->first;
int i;
for(i=0; i < gap; i++){
prep->intFrames[i] = (PFrame)malloc(sizeof(Frame));
copyFrame(prep->intFrames[i], prep->first, i); //LINE 189
}
}
void copyFrame(PFrame new, PFrame copy, int num){
new->sequence = copy->sequence;
new->evaluatedFrame = copy->evaluatedFrame + num;
new->numBoxes = copy->numBoxes;
new->boxes = (PBox*)malloc(copy->numBoxes*sizeof(PBox));
int i;
for(i=0; i < copy->numBoxes; i++){
PBox old = copy->boxes[i];
new->boxes[i] = (PBox)malloc(sizeof(Box));
copyBox(new->boxes[i], old);
}
}
我得到這個錯誤:
error: called object ‘copyFrame’ is not a function
原型匹配的定義。是什麼賦予了?
在這種情況下,有兩件事情叫'copyFrame'。嘗試重命名'PFrame copyFrame'。 – Pubby
您應該打開一些[編譯器警告](http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html):)如果使用gcc,至少需要'-Wshadow'。我也推薦' - 牆' – Joe