Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext Thread*Show in Threaded Mode


Subjecta bit off topic, but I imagine someone here can help me out new Reply to this message
Posted byCreepingDeath
Posted on11/04/03 01:40 PM



I am using MSVC 6.0 with the latest service pack and when I go to compile one specific project of mine, I get compiler errors that say NULL is an undeclared identifier. As far as I know, NULL is always supposed to work. Is there a known problem that causes NULL to not be recognized?

The project is a windows program. Currently WinMain does nothing except return 1. The program compiles just fine when I change all the NULLs to 0. I am a fairly experienced programmer, and I would like to think that I am not a complete moron, but I have no idea what the problem is. Any help would be greatly appreciated.


SubjectRe: a bit off topic, but I imagine someone here can help me out Reply to this message
Posted byfrostgiant
Posted on11/04/03 03:50 PM



> I am using MSVC 6.0 with the latest service pack and when I go to compile one
> specific project of mine, I get compiler errors that say NULL is an undeclared
> identifier. As far as I know, NULL is always supposed to work. Is there a
> known problem that causes NULL to not be recognized?
>
> The project is a windows program. Currently WinMain does nothing except return
> 1. The program compiles just fine when I change all the NULLs to 0. I am a
> fairly experienced programmer, and I would like to think that I am not a
> complete moron, but I have no idea what the problem is. Any help would be
> greatly appreciated.
>

Perhaps:

#ifndef NULL
#define NULL 0
#endif

I think NULL is defined based on the headers you use.




SubjectRe: a bit off topic, but I imagine someone here can help me out new Reply to this message
Posted by.Raiden16.
Posted on11/04/03 03:50 PM



I'm not sure but NULL should be declared in one of the header includes that are standard. I really don't know which one offhand. stdlib.h maybe?

> I am using MSVC 6.0 with the latest service pack and when I go to compile one
> specific project of mine, I get compiler errors that say NULL is an undeclared
> identifier. As far as I know, NULL is always supposed to work. Is there a
> known problem that causes NULL to not be recognized?
>
> The project is a windows program. Currently WinMain does nothing except return
> 1. The program compiles just fine when I change all the NULLs to 0. I am a
> fairly experienced programmer, and I would like to think that I am not a
> complete moron, but I have no idea what the problem is. Any help would be
> greatly appreciated.
>





SubjectLooks like you are both correct new Reply to this message
Posted byCreepingDeath
Posted on11/04/03 04:00 PM



I guess NULL is defined in stdio.h, among others. I have to admit, I am shocked that I have never run into this problem before. I guess I thought NULL was a borderline keyword or something :P Thanks guys.


Almost as cool as Audioscrobbler



Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode