Thread: symbol "NULL" not found????

  1. #1
    Unregistered
    Guest

    symbol "NULL" not found????

    my program compiles fine. but when i run it i get an error. it points to this line
    Code:
    if (FAILED(lpDD->CreateSurface(&ddsd, &DDSPrimary, NULL)))
    but when i try to check the result of failed with a quickwatch( im using VC++ 6.0) it says: symbol "NULL" not found. if i use a quickwatch on just the NULL part it says the same thing. i dont understand stand it. if it says that, why did it compile? maybe i need to reinstall VC++. anyone have any ideas???

    TIA
    Echo

  2. #2
    NULL has to be defined. Although, usually it is already. I don't know, I don't use VC++.

  3. #3
    Unregistered
    Guest
    how would i define NULL??

  4. #4
    Unregistered
    Guest
    Put this in your #defines (usually below #includes but above globals).

    #define NULL 0

    Some people cast it as a pointer to void, but for most uses 0 is fine.

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    Another means is to declare:
    Code:
    const int NULL = 0;
    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  6. #6
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    In "The C++ Programming Language" by Bjarne Stroustrup.... Bjarne says,
    In C, it has been popular to define a macro NULL to represent the zero pointer. Because of C++'s tighter type checking, the use of plain 0, rather than any suggested NULL macro, leads to fewer problems. If you feel you must define NULL, use
    Code:
    const int NULL = 0;

  7. #7
    Registered User
    Join Date
    Jul 2002
    Posts
    273

    Talking Seinfeld thread.

    Wow, a thread about nothing!

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Use one of these (but not the const int thing)
    Code:
    #define NULL 0
    //or
    #define NULL 0L
    //or
    #define NULL ((void *)0)
    The seconde one is really not necessary since an int is long in win32. And the third is actually not all that uncommon. But this assumes that NULL is always a pointer. If I were you I would cut this and put it in my code
    Code:
    #ifndef NULL
    #define NULL 0
    #endif

  9. #9
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    NULL is defined in stdio.h

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Symbol not found?
    By pighogswine in forum C Programming
    Replies: 9
    Last Post: 10-28-2007, 11:07 AM
  2. inet_aton()... Noob needs help with sockets :|
    By Maz in forum C++ Programming
    Replies: 3
    Last Post: 11-22-2005, 04:33 PM
  3. help!!!!
    By johnh444 in forum C++ Programming
    Replies: 5
    Last Post: 07-04-2004, 01:16 PM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM