Re: [Dev-C++] Error compiling "file_one" from tutorials.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Nick <en...@ho...> - 2000-12-12 19:25:54
|
Hello, > This is from the Forger's Win32 API tutorials. I tried to compile the > example "file_one" but in File_one.c I got the following error > messages: > > 17 file_one.c > warning: converting NULL to non-pointer type Ok, NULL is used for pointers. Make sure that NULL is being assigned to a pointer (eg: char * and not char) Actually, looking at the call below, should you really be assigning a NULL pointer to the above code or should it be the NUL character instead '\0'? > > 25 file_one.c > ANSI C++ forbids implicit conversion from `void *' in assignment Ok, generally, *.c files are compiled as C, not C++. C allows the implicit conversion, whereas C++ does not. You must provide a cast for the returned value (or compile as a C program). > > 49 file_one.c > warning: converting NULL to non-pointer type As above... > > 57 file_one.c > ANSI C++ forbids implicit conversion from `void *' in assignment Again... > > 179 file_one.c > warning: converting NULL to non-pointer type > Again... > 0 > > Both have the following same line of code: > > pszText = GlobalAlloc(GPTR, dwTextLength + 1); Ok, using the above variable notation, I would assume that pszText is defined as char * or equivalent (pointer to NUL terminated array of char.) pszText = (char *) GlobalAlloc(GPTR, dwTextLength + 1); Hopefully that helped, otherwise feel free to post more of the offending code, or a link if it's online. -- regards, Nick |