i have a list struct:
typedef struct FaceNode{
FaceNode *next;
Face *aFace;
FaceNode *prev;
} FaceNode;
I use this struct as a member:
FaceNode *myFaces;
and initialize it like this (in a constructor)
this->myFaces = (FaceNode*)malloc(sizeof(FaceNode)*1);
Later I want to free it as follows:
FaceNode *theCurrentFaceNode;
Face* theCurrentFace;
while(this->myFaces->next){
theCurrentFaceNode = this->myFaces;
theCurrentFace = theCurrentFaceNode->aFace;
this->myFaces = this->myFaces->next;
free(theCurrentFace);
free(theCurrentFaceNode);
}
Now my IDE tells me: “Error, too many arguments in function call” for the free call.
What is wrong about that?
Cheers
You have evidently declared a function of your own named
free, and the compiler is finding that instead of the one you thought you were calling. Use the scope-resolution operator to call the global function:Or find the other
freefunction and give it a different name. It might be a member of the class you’re implementing; look in the class’s ancestor classes, too.