Hi,

I'm trying to run the following (I thought it be a good place to start!),


#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int
main(int argc, char ** argv)
{
        Fl_Window *window;
        window = new Fl_Window(300, 180);

        Fl_Box *box;
        box = new Fl_Box(20, 40, 260, 100, "Hello World!");
        box->box(FL_UP_BOX);
        box->labelsize(36);
        box->labelfont(FL_BOLD+FL_ITALIC);
        box->labeltype(FL_SHADOW_LABEL);

        window->end();
        window->show(argc, argv);

        return(Fl::run());
}


However I get the following compilation errors,

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\projects\FLTK\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\projects\FLTK\Makefile.win" all
g++.exe -c main.cxx -o main.o -I"C:/Dev-Cpp/include/c++"  
-I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include/c++/mingw32"  
-I"C:/Dev-Cpp/include/c++/backward"
g++.exe main.o GUIFLTK_private.res -o "GUIFLTK.exe" -L"C:/Dev-Cpp/lib" 
-mwindows -lfltk -lole32 -luuid -lcomctl32 -lwsock32 -lm
C:/Dev-Cpp/lib/libfltk.a(Fl_Box.o)(.rdata$_ZTV6Fl_Box+0x0):Fl_Box.cxx: multiple 
definition of `vtable for Fl_Box'
main.o(.data$_ZTV6Fl_Box+0x0):main.cxx: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Box.o)(.rdata$_ZTI6Fl_Box+0x0):Fl_Box.cxx: multiple 
definition of `typeinfo for Fl_Box'
main.o(.data$_ZTI6Fl_Box+0x0):main.cxx: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Box.o)(.rdata$_ZTS6Fl_Box+0x0):Fl_Box.cxx: multiple 
definition of `typeinfo name for Fl_Box'
main.o(.text$_ZTS6Fl_Box+0x0):main.cxx: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Box.o)(.rdata$_ZTI9Fl_Widget+0x0):Fl_Box.cxx: 
multiple definition of `typeinfo for Fl_Widget'
main.o(.data$_ZTI9Fl_Widget+0x0):main.cxx: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Box.o)(.rdata$_ZTS9Fl_Widget+0x0):Fl_Box.cxx: 
multiple definition of `typeinfo name for Fl_Widget'
main.o(.text$_ZTS9Fl_Widget+0x0):main.cxx: first defined here
make.exe: *** [GUIFLTK.exe] Error 1
Execution terminated

I'm guessing that as Fl_Box is a derivative class of Fl_Widget, and the 
constructor in Fl_Widget is declared as virtual, that this problem has 
something to do with polymorphism. As might be expected, if I comment out the 
central section of main() to do with the box object, I don't get any errors 
(just a window!).
Does anybody have any ideas? I know this is a bit simple, but I thought it best 
to get off on the right foot and it will be educational for me!

Thank you,
Sean

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to