Mail Archives: djgpp/2000/02/23/15:15:59
Yeah I've hit this before.
You need to cast the buttons caption ie that string in the dp field, to
(void *) when compiling under C++. In fact C++ is good for compiling C
progs as it finds mistakes with its stronger type checking.
Nigel Atkinson
-----Original Message-----
From: Riddler02 AT aol DOT com [mailto:Riddler02 AT aol DOT com]
Sent: Wednesday, 23 February 2000 15:25
To: djgpp AT delorie DOT com
Subject: d_button_proc - errors in C++, but not C?
hello once again,
Now that I have begin exploring the wonderful world of Allegro GUI
functions,
I have come across a slight problem. The Allegro GUI example program,
EX13.C
(which is located in C:\DJGPP\ALLEGRO\EXAMPLES for me) compiles n' links and
runs perfectly. However, if I change its name to EX13.CPP (or anything.cpp
for that matter), I get the following error at every occurrence of the
d_button_proc function when I try to compile:
Error: initialization to "void *" from "const char *" discards
qualifiers.
For example, a program with the .CPP extention containing the following
dialog would compile fine
DIALOG main_dialog[] =
{ d_clear_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, NULL, NULL, NULL },
NULL, (blah blah
blah...........................................................) }
};
but a dialog with d_button_proc won't
DIALOG main_dialog[] =
{ d_clear_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, NULL, NULL, NULL },
d_button_proc, numbers
numbers......................................... },
NULL, blah blah
blah........................................................... }
};
It would seem that I need to typecast something here, as is the case with
many C/C++ compatability issues, but I don't know what - pleez help!
-Kevin
- Raw text -