Miklos Espak wrote:
> I am a beginner in FLTK and cannot figure out what's wrong
> with the following code. Segmentation fault occures at the
> consoleWindow->show() invocation.

        Hmm, your code works OK for me and looks fine.

        Can you provide some details:
        
                Which OS
                Which compiler
                What are your compile/link lines?
                What directory is your version of FLTK installed,
                and how was it installed? (did you build yourself, or use a 
package installer)

        Perhaps it's a problem with the compiler or link flags.

        Do you perhaps have multiple versions of FLTK installed?

        If so, there might be crosstalk between the headers you're #include'ing
        and the libs you're linking against that can cause perfectly OK code to 
crash.
        (in other words, you might be #include'ing headers from a different 
version
        of FLTK than you're linking against).


> Could you help me, please?
> 
> Thank you,
> Miklos
> 
> #include <FL/Fl.H>
> #include <FL/Fl_Double_Window.H>
> #include <FL/Fl_Box.H>
> 
> class UserInterface {
> public:
>   UserInterface();
>   Fl_Double_Window *consoleWindow;
>   void show();
> };
> 
> UserInterface::UserInterface() {
>   { consoleWindow = new Fl_Double_Window(345, 175);
>     consoleWindow->user_data((void*)(this));
>     { new Fl_Box(80, 35, 25, 25, "Hello");
>     } // Fl_Box* o
>     consoleWindow->end();
>   } // Fl_Double_Window* consoleWindow
> }
> 
> void UserInterface::show() {
>     consoleWindow->show();
> }
> 
> int main(int argc, char **argv) {
>   UserInterface* ui = new UserInterface();
>   ui->show();
>   return Fl::run();
> }
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to