Hi,
I'm using a simple dialog gui adapted from the
examples of allegro (the code is given below).
The code compiles and run without problem in C and
give me the following error if compiled in C++.
I'm using djgpp.
the error given by the compiler :
test.cpp:16: initialization to `void *' from `const
char *' discards qualifiers
test.cpp:16: initialization to `void *' from `const
char *' discards qualifiers
And here is the code :
#include <stdio.h>
#include <allegro.h>
#include "example.h"
DATAFILE *datafile;
FONT *original_font;
DIALOG the_dialog[] =
{
/* (dialog proc) (x) (y) (w) (h) (fg)
(bg) (key) (flags) (d1) (d2)
(dp) (dp2) (dp3) */
{ d_button_proc, 360, 400, 161, 49, 255,
0, 0, D_EXIT, 0, 0,
"Continue", NULL, NULL },
{ d_button_proc, 80, 400, 161, 49, 255,
0, 0, D_EXIT, 0, 0,
"Quit", NULL, NULL },
{ NULL, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
NULL, NULL, NULL }
};
int main(int argc, char *argv[])
{
int ret;
char buf1[256], buf2[80], buf3[80];
/* initialise everything */
allegro_init();
install_keyboard();
install_mouse();
install_timer();
if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Unable to set any graphic
mode\n%s\n", allegro_error);
return 1;
}
set_palette(desktop_palette);
/* load the datafile */
//replace_filename(buf1, argv[0], "",
sizeof(buf1));
datafile = load_datafile("example.dat");
if (!datafile) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Error loading %s!\n", buf1);
return 1;
}
/* store a copy of the default font */
original_font = font;
/* do the dialog */
ret = do_dialog(the_dialog, -1);
if (ret==1)
textout_centre(screen, font, "Quit have been
clicked over", 320, 210, 1);
else{
textout_centre(screen, font, "Continue have been
clicked over", 320, 210, 1);
readkey();
}
unload_datafile(datafile);
return 0;
}
END_OF_MAIN();
Thank you for advance
=====
http://zerioh.tripod.com
__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer
|