Re: Home grown error dialog



Could it be this bug?

http://gcc.gnu.org/ml/gcc-bugs/2004-06/msg03111.html

Rob.

On 08/12/05, Bob Caryl <bob fis-cal com> wrote:
> Hey guys:
>
> I created my own little version of Gtk::MessageDialog that uses
> stdargs.h to create its message string.  It is part of a little dynamic
> library I link into my applications.
>
> Code follows:
>
> ErrorDialog.h contains:
>
> #ifndef __FISCAL_ERRORDIALOG_
> #define __FISCAL_ERRORDIALOG_
> #include <gtkmm.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <stdarg.h>
>
> class ErrorDialog
> {
> public:
>     ErrorDialog(gint type, char *formatstr, ... );
>     gint run(void);
>     enum { ERROR, QUESTION };
> protected:
>     Gtk::MessageDialog *db;
> };                  // ====== > line 22
>
> #endif
>
> ErrorDialog.cpp contains:
>
> #include "ErrorDialog.h"
> #include "fiscal.c"
>
> int ErrorDialog::run(void)
> {
>     int response = db->run();
>     delete db;
>     return response;
> }
>
> ErrorDialog::ErrorDialog(gint type, char *fmt, ...)
> {
>     Glib::RefPtr<Gdk::Pixbuf> fis_icon =
> Gdk::Pixbuf::create_from_inline(-1,fisicon_inline,FALSE);
>
>     int n, size = 100;
>     char *p, *np;
>     va_list ap;
>
>     p = (char *)malloc(size);
>
>     while (1)
>     {
>         va_start(ap, fmt);
>         n = vsnprintf (p, size, fmt, ap);
>         va_end(ap);
>         if (n > -1 && n < size)
>             break;
>         if (n > -1)
>             size = n+1;
>         else
>             size *= 2;  /* twice the old size */
>         np = (char *)realloc (p, size);
>         p = np;
>     }
>
>     db = new Gtk::MessageDialog(p,
>             FALSE,
>
> (type==ErrorDialog::QUESTION?Gtk::MESSAGE_QUESTION:Gtk::MESSAGE_ERROR),
>
> (type==ErrorDialog::QUESTION?Gtk::BUTTONS_YES_NO:Gtk::BUTTONS_OK)
>         );
>
>     free(p);
>     db->set_icon(fis_icon);
>     db->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
> }
>
>
> I'm getting this error when this is linked into my application:
>
> /home/bob/Projects/fiscal/include/ErrorDialog.h:22: error: multiple
> types in one declaration
>
> Any ideas on what I've done wrong here?
>
> Bob
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]