'NODE' undeclared (first use in this function)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: 'NODE' undeclared (first use in this function)

Threaded View

  1. #1
    Join Date
    Mar 2010
    Melbourne Australia

    'NODE' undeclared (first use in this function)

    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
    #ifndef LINKEDLIST_H
    #define LINKEDLIST_H
    #include <stdlib.h>
    #include <sys/stat.h>
    #include <signal.h>
    #ifndef NULL
    #define NULL 0
    #ifdef __cplusplus
    extern "C" {
    /* Function code goees here  */
    struct NODE
        char val;
        int  pos;
        struct NODE *previous, *next;
    struct NODE *CreateList();
    #ifdef __cplusplus
    #endif // LINKEDLIST_H
    and C file

    #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;
    when compiling I am getting the following error
    'NODE' undeclared (first use in this function)


    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 .
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

HTML5 Development Center