Thread: C2025 - Undeclared Identifier 'NULL'

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    93

    C2025 - Undeclared Identifier 'NULL'

    Have the following abstract class, not sure why I am getting an error on the constructor

    Code:
    #ifndef __SCRIO_H
    #define __SCRIO_H
    
    class IOScreen;
    
    class IOField
    {
    
    	private:
    			int row,
    				col;
    	protected:
    			void *data;
    			IOScreen *owner;
    			bool Ok;
    			void (*help)(IOScreen *scrPtr); 
    			bool (*isValid)(void *data, IOScreen *scrPtr);
    			int Row();
    			int Col();
    
    	public:
    			IOField(int row, int col, 
    				    void (*help)(IOScreen *) = NULL,
    					bool (*isValid)(void *, IOScreen *) = NULL);
    			virtual ~IOField();
    			virtual void display()=0;
    			virtual int edit()=0;
    			virtual void *getData();
    			bool failed();
    			virtual void clear();
    			IOScreen *getOwner;
    			void setOwner(IOScreen *owner);
    };
    #endif
    Code:
    error C2065: 'NULL' : undeclared identifier

  2. #2
    Registered User
    Join Date
    Nov 2004
    Posts
    93
    Whoa dont tell me NULL is nonstandard, 0 works.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    NULL is standard, although 0 is preferred.

    To use NULL, you have to include a header that defines it.

  4. #4
    Registered User
    Join Date
    Nov 2004
    Posts
    93
    Alrighty, thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. Replies: 6
    Last Post: 03-02-2005, 02:45 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM