error C2065: undeclared identifier

This is a discussion on error C2065: undeclared identifier within the Windows Programming forums, part of the Platform Specific Boards category; I get compiler errors after declaring PNDIS_GENERIC_OBJECT variable. Any suggestion what should I do? stat.c Code: #include <ntddk.h> #include <ndis.h> ...

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    5

    error C2065: undeclared identifier

    I get compiler errors after declaring PNDIS_GENERIC_OBJECT variable. Any suggestion what should I do?

    stat.c
    Code:
      #include <ntddk.h>
        #include <ndis.h>
        
        #include "stat.h"
        
       
         VOID DriverUnload(IN PDRIVER_OBJECT driverObject){
                UNREFERENCED_PARAMETER(driverObject);        
        }
    
    
        NTSTATUS DriverEntry(    IN  PDRIVER_OBJECT  driverObject,
                                IN  PUNICODE_STRING registryPath)
        {
            NTSTATUS status = STATUS_SUCCESS;
            
            PNDF__ETH_HEADER pEthHeader;
            PNDF_IPV4_HEADER pIPv4Header;
            ULONG DataOffset = 0;
        
            if (driverObject != NULL)
                driverObject->DriverUnload = DriverUnload;
                
            return status;
        }

    stat.h
    Code:
    #ifndef STAT_H_
    #define STAT_H_
    
    
    #define ETHERTYPE_IP 0x0800
    
    
    typedef struct _NDF_ETH_HEADER
    {
        UCHAR  dmac[6];
        UCHAR  smac[6];
        USHORT type;
        
    } NDF_ETH_HEADER, *PNDF_ETH_HEADER;
     
    C_ASSERT( sizeof( NDF_ETH_HEADER) == 14 );
     
    
    
    typedef struct _NDF_IPV4_HEADER
    {
        UCHAR  ver_ihl;        // Version (4 bits) + Internet header length (4 bits)
        UCHAR  tos;            // Type of service 
        USHORT length;         // Total length 
        USHORT id;             // Identification
        USHORT flags_fo;       // Flags (3 bits) + Fragment offset (13 bits)
        UCHAR  ttl;            // Time to live
        UCHAR  protocol;       // Protocol
        USHORT checksum;       // Header checksum
        UCHAR  saddr[4];       // Source address
        UCHAR  daddr[4];       // Destination address
        
    } NDF_IPV4_HEADER, *PNDF_IPV4_HEADER;
     
    C_ASSERT( sizeof( NDF_IPV4_HEADER)== 20 );
    
    
    
    
    #endif // _STAT_H_

    SOURCES
    Code:
    TARGETNAME=stat
    TARGETPATH=obj
    TARGETTYPE=DRIVER
    SOURCES= stat.c
    INCLUDES=.
    
    
    TARGETLIBS=\
        $(DDK_LIB_PATH)\ntoskrnl.lib \
        $(DDK_LIB_PATH)\ndis.lib \
        $(DDK_LIB_PATH)\fwpkclnt.lib \
        $(SDK_LIB_PATH)\uuid.lib
    
    
    C_DEFINES=$(C_DEFINES) -DBINARY_COMPATIBLE=0 -DNT -DUNICODE -D_UNICODE -DNDIS60 -DNDIS_SUPPORT_NDIS6
    Code:
    .c(16) : error C2065: 'PNDF__ETH_HEADER' : undeclared identifier
    .c(16) : error C2146: syntax error : missing ';' before identifier 'pEthHeader'
    .c(16) : error C2065: 'pEthHeader' : undeclared identifier
    .c(17) : error C2275: 'PNDF_IPV4_HEADER' : illegal use of this type as an expression
    .c(17) : error C2146: syntax error : missing ';' before identifier 'pIPv4Header'
    .c(17) : error C2065: 'pIPv4Header' : undeclared identifier
    .c(18) : error C2275: 'ULONG' : illegal use of this type as an expression
    .c(18) : error C2146: syntax error : missing ';' before identifier 'DataOffset'
    .c(18) : error C2065: 'DataOffset' : undeclared identifier
    Thanks in advice

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,259
    Try counting the underscores used on line 17.

  3. #3
    Registered User
    Join Date
    Jan 2012
    Posts
    5
    Quote Originally Posted by SMurf View Post
    Try counting the underscores used on line 17.
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error C2065: undeclared identifier
    By decxan in forum C++ Programming
    Replies: 2
    Last Post: 02-14-2011, 12:42 PM
  2. error C2065: 'inet_pton' : undeclared identifier - ipv6
    By WeberGer in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-14-2010, 10:38 AM
  3. error C2065: undeclared identifier PLEASE HELP!
    By dyelax in forum C++ Programming
    Replies: 13
    Last Post: 10-12-2009, 11:50 AM
  4. Compiler error error C2065: '_beginthreadex; : undeclared identifier
    By Roaring_Tiger in forum Windows Programming
    Replies: 3
    Last Post: 04-29-2003, 01:54 AM
  5. error C2065 undeclared identifier
    By scott27349 in forum C++ Programming
    Replies: 6
    Last Post: 03-10-2002, 03:22 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21