View Full Version : this is dumb...

11-04-2005, 01:38 PM
i know this is an easy fix.. but ive tried everything just too fix this simple error... it never use to do this...

hwnd = CreateWindowEx(NULL, // The extended window style.
"OpenGL", // window Class name.
"OpenGL Basic Window",// window name.
WS_SYSMENU | WS_CLIPCHILDREN | // window style.
WS_CLIPSIBLINGS, // window style.
100, 100, // window x, y coordinate.
640, 480, // window width and height.
NULL, // handle to parent window.
NULL, // menu.
hInstance, // handle to app instance.
NULL); // pointer to window creation data.at the end where it says pointer to window creation... i keep getting this error

C:\Documents and Settings\Owner\Desktop\Gl_Intro\Intro\Window.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
178 C:\Documents and Settings\Owner\Desktop\Gl_Intro\Intro\Window.cpp [Warning] passing NULL used for non-pointer converting 1 of `HWND__* CreateWindowExA(DWORD, const CHAR*, const CHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)' everything is linked right... its a building error
lol im pretty sure someone knows this...

11-04-2005, 04:11 PM
First, it's not an error, it's a warning. Take a closer look at the message; it says [Warning].

Second, what it's complaining about is that you're passing NULL when the actual parameter is not a pointer type. First parameter of CreateWindowEx is a bit mask (an integer), not a pointer.

Altough, in C++, NULL is defined as 0, which is a perfectly valid integer value, there is an important conceptual difference between actually typing 0 and NULL. NULL indicates a pointer type, but the parameter isn't a pointer type. I would guess the compiler is issuing a warning because of this to tell you that you're using NULL for the wrong purpose. If you intend to use the integer value zero, then type 0.

11-06-2005, 09:25 PM
He may have "treat warnings as errors" or something like that enabled. However, as stated, yes, the compiler appears to not like that a a symbol defined as a pointer is being passed in a place where an actual numeric value is desired.