I am developing a double linked list in C ( development environment ) is QT with mingw32 4.7 gcc / g++ compiler ,
in the header file I have defined struct as follows
and C fileCode:#ifndef LINKEDLIST_H #define LINKEDLIST_H #include <stdlib.h> #include <sys/stat.h> #include <signal.h> #ifndef NULL #define NULL 0 #endif #ifdef __cplusplus extern "C" { #endif /* Function code goees here */ struct NODE { char val; int pos; struct NODE *previous, *next; }; struct NODE *CreateList(); #ifdef __cplusplus } #endif #endif // LINKEDLIST_H
when compiling I am getting the following errorCode:#include "LinkedList.h" struct NODE *CreateList() { struct NODE *node; node = (NODE *)malloc(sizeof(NODE)); if(node == NULL){ return NULL; } node->pos =0; node->previous = NULL; node->next = NULL; return node; }
'NODE' undeclared (first use in this function)
and
each undeclared identifier is reported only once for each function it appears in
I have also attached the screen shot from the QT IDE
look's like the compiler is not able to pick up the definition of NODE structure
same happens in Netbeans IDE , interesting thing is if change the source file from c to cpp the error goes away .
Any help would be much appreciated .




Reply With Quote