Thread: [Dev-C++] Differences in compilers
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Danny A. <tam...@ms...> - 2002-04-14 01:59:55
|
Hey guys this is probably a really stupid question but I got a problem I =
feel is totally compiler related. I'm still using a book called "C++ PRO=
GRAMMING for the Absolute Beginner," and its compatible with a compiler c=
alled "CODE WARRIOR". I have typed out a very simple code for Windows 32 =
apps and I have an error "NULL not declared," and below is the code. I =
was just wondering what I might have to adjust or keep in mind when deali=
ng with different compilers because the author figures this will run no p=
roblem. =20
#include <windows.h>
//win32 entry-point routine
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE hPreInst, =20
LPSTR lpszCmdLine, =20
int nCmdShow)
{
MessageBox(Null, "Windows Programming is Easy!!",
"My First Message Box",
MB_OKCANCEL | MB_ICONINFORMATION);
}
|
|
From: Jason H. <jas...@bt...> - 2002-04-14 13:36:55
|
Try writing NULL in all caps. AFAIK most definitions of NULL are done =
all in upper case letters. If I remember correctly NULL is normally =
defined thus:
#define NULL (void*) 0;
Although that could be wrong. In the end all NULL are effectivly zero in =
one form or another.
Jason.
----- Original Message -----=20
From: Danny Austin=20
To: dev...@li...=20
Sent: Sunday, April 14, 2002 2:59 AM
Subject: [Dev-C++] Differences in compilers
Hey guys this is probably a really stupid question but I got a problem =
I feel is totally compiler related. I'm still using a book called "C++ =
PROGRAMMING for the Absolute Beginner," and its compatible with a =
compiler called "CODE WARRIOR". I have typed out a very simple code for =
Windows 32 apps and I have an error "NULL not declared," and below is =
the code. I was just wondering what I might have to adjust or keep in =
mind when dealing with different compilers because the author figures =
this will run no problem.=20
#include <windows.h>
//win32 entry-point routine
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE hPreInst,=20
LPSTR lpszCmdLine,=20
int nCmdShow)
{
MessageBox(Null, "Windows Programming is Easy!!",
"My First Message Box",
MB_OKCANCEL | MB_ICONINFORMATION);
}
|
|
From: Ioannis V. <no...@ho...> - 2002-04-14 13:42:40
|
-----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Hardman Sent: Sunday, April 14, 2002 4:36 PM To: Dev-C++; Danny Austin Subject: Re: [Dev-C++] Differences in compilers Try writing NULL in all caps. AFAIK most definitions of NULL are done all in upper case letters. If I remember correctly NULL is normally defined thus: NULL definition is always in capital letters. #define NULL (void*) 0; It depends on the language. For C it is usually the above (without the ';'). For C++ the best definition of NULL is #define NULL 0 Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.cjb.net/> http://www.noicys.cjb.net * Alternative URL: <http://run.to/noicys> http://run.to/noicys |
|
From: Ioannis V. <no...@ho...> - 2002-04-14 13:46:52
|
-----Original Message----- From: Ioannis Vranos [mailto:no...@ho...] Sent: Sunday, April 14, 2002 4:42 PM To: Dev-C++ Subject: RE: [Dev-C++] Differences in compilers -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Hardman Sent: Sunday, April 14, 2002 4:36 PM To: Dev-C++; Danny Austin Subject: Re: [Dev-C++] Differences in compilers Try writing NULL in all caps. AFAIK most definitions of NULL are done all in upper case letters. If I remember correctly NULL is normally defined thus: NULL definition is always in capital letters. #define NULL (void*) 0; It depends on the language. For C it is usually the above (without the ';'). For C++ the best definition of NULL is #define NULL 0 Or better: const int NULL=0; But the best in C++ is to use 0 directly. Reference: Paragraph 5.1.1 on page 88 of "The C++ Prrogramming Language" 3rd Edition or Special Edition. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ho...> - 2002-04-14 13:48:32
|
Sorry for the huge letters. ^%*&$# outlook. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys -----Original Message----- From: Ioannis Vranos [mailto:no...@ho...] Sent: Sunday, April 14, 2002 4:46 PM To: Dev-C++ Subject: RE: [Dev-C++] Differences in compilers Or better: const int NULL=0; But the best in C++ is to use 0 directly. Reference: Paragraph 5.1.1 on page 88 of "The C++ Prrogramming Language" 3rd Edition or Special Edition. |
|
From: christiaan s. <ck...@ia...> - 2002-04-14 13:47:49
|
try replacing Null with NULL. c++ is case sensitive
----- Original Message -----=20
From: Danny Austin=20
To: dev...@li...=20
Sent: Sunday, April 14, 2002 3:59 AM
Subject: [Dev-C++] Differences in compilers
Hey guys this is probably a really stupid question but I got a problem =
I feel is totally compiler related. I'm still using a book called "C++ =
PROGRAMMING for the Absolute Beginner," and its compatible with a =
compiler called "CODE WARRIOR". I have typed out a very simple code for =
Windows 32 apps and I have an error "NULL not declared," and below is =
the code. I was just wondering what I might have to adjust or keep in =
mind when dealing with different compilers because the author figures =
this will run no problem.=20
#include <windows.h>
//win32 entry-point routine
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE hPreInst,=20
LPSTR lpszCmdLine,=20
int nCmdShow)
{
MessageBox(Null, "Windows Programming is Easy!!",
"My First Message Box",
MB_OKCANCEL | MB_ICONINFORMATION);
}
|