Menu

FLTK error: multiple definition of `type...

2004-09-24
2012-09-26
  • Nobody/Anonymous

    I keeps getting " multiple definition of `typeinfo name for Fl_Gl_Window' " error when I compile and link the following simple program.
    I included all the lib and added linker parameters that peopled mentioned previously.

    The source code and compile log:

    include <FL/Fl_Gl_Window.h>

    include <Fl/Fl.h>

    include <windows.h>

    include <GL/gl.h>

    // make a Gl window that draws something:
    class MyGlWindow : public Fl_Gl_Window {
    public:
    MyGlWindow(int x, int y, int w, int h) :
    Fl_Gl_Window(x,y,w,h,"My GL Window")
    {
    }
    private:
    void draw() { // the draw method must be private
    glClearColor(0,0,0,0); // clear the window to black
    glClear(GL_COLOR_BUFFER_BIT); // clear the window

    glColor3f(1,1,0); // draw in yellow
    glRectf(-.5,-.5,.5,.5); // draw a filled rectangle
    };
    };

    // the main routine makes the window, and then runs an even loop
    // until the window is closed
    main()
    {
    MyGlWindow* gl = new MyGlWindow(100,100,500,500);
    gl->show(); // this actually opens the window

    Fl::run();
    delete gl;

    return 1;
    }


    Compiler: Default compiler
    Building Makefile: "U:\dev\works\prj\Makefile.win"
    Executing make...
    make.exe -f "U:\dev\works\prj\Makefile.win" all
    windres.exe -i Project1_private.rc -I rc -o Project1_private.res -O coff

    g++.exe -DDEBUG prj.cpp].o Project1_private.res -o "Project1.exe" -L"U:/dev/lib" -mwindows -lfltk -lole32 -luuid -lcomctl32 -lwsock32 -lm ../../lib/libfltk_gl.a ../../lib/libopengl32.a ../../lib/libfltk_forms.a ../../lib/libfltk.a -g3

    U:/dev/lib/libfltk.a(Fl.o)(.data$_ZTI9Fl_Window+0x0):Fl.cxx: multiple definition of typeinfo for Fl_Window' prj.cpp].o(.rdata$_ZTI9Fl_Window+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here U:/dev/lib/libfltk.a(Fl.o)(.text$_ZTS9Fl_Window+0x0):Fl.cxx: multiple definition oftypeinfo name for Fl_Window'
    prj.cpp].o(.rdata$_ZTS9Fl_Window+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here
    U:/dev/lib/libfltk.a(Fl.o)(.data$_ZTI8Fl_Group+0x0):Fl.cxx: multiple definition of `typeinfo for Fl_Group'
    prj.cpp].o(.rdata$_ZTI8Fl_Group+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here

    U:/dev/lib/libfltk.a(Fl.o)(.text$_ZTS8Fl_Group+0x0):Fl.cxx: multiple definition of typeinfo name for Fl_Group' prj.cpp].o(.rdata$_ZTS8Fl_Group+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here U:/dev/lib/libfltk.a(Fl.o)(.data$_ZTI9Fl_Widget+0x0):Fl.cxx: multiple definition oftypeinfo for Fl_Widget'
    prj.cpp].o(.rdata$_ZTI9Fl_Widget+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here
    U:/dev/lib/libfltk.a(Fl.o)(.text$_ZTS9Fl_Widget+0x0):Fl.cxx: multiple definition of typeinfo name for Fl_Widget' prj.cpp].o(.rdata$_ZTS9Fl_Widget+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here ../../lib/libfltk_gl.a(Fl_Gl_Window.o)(.data$_ZTI12Fl_Gl_Window+0x0):Fl_Gl_Window.cxx: multiple definition oftypeinfo for Fl_Gl_Window'

    prj.cpp].o(.rdata$_ZTI12Fl_Gl_Window+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here

    ../../lib/libfltk_gl.a(Fl_Gl_Window.o)(.text$_ZTS12Fl_Gl_Window+0x0):Fl_Gl_Window.cxx: multiple definition of `typeinfo name for Fl_Gl_Window'

    prj.cpp].o(.rdata$_ZTS12Fl_Gl_Window+0x0):U:/dev/works/prj/prj.cpp].cpp:26: first defined here

    make.exe: *** [Project1.exe] Error 1

    Execution terminated

    Thanks 10^10 times!

     
    • Wayne Keen

      Wayne Keen - 2004-09-24

      Have you tried compiling the example FLTK project?

      And what version of Dev are you using?

      Wayne

       
    • Nobody/Anonymous

      I just installed the latest versions of both devC++ and FLTK devpack. The hello program works.
      It seems to me that it just doesn't work properly with openGL.

       
    • Wayne Keen

      Wayne Keen - 2004-09-24

      Now, I have to ask a question the second time: What version of Dev are you using? "Latest" tells me absolutely NOTHING.

      Wayne

       
    • Wayne Keen

      Wayne Keen - 2004-09-24

      I seem to be reproducing your result with Dev 4.9.9.0 and Windows XP Pro...

      Wayne

       
    • Nobody/Anonymous

      yes. I'm using Dev 4.9.9.0 and WindowsXP professional.

      Do you have any clue about this problem?

      Thanks again!

       
    • Wayne Keen

      Wayne Keen - 2004-09-24

      I am in the middle of running a ton of errands...hopefully I will get to play later.

      Wayne

       
    • Nobody/Anonymous

      I compiled a small test program using FLTK, in this case using the Fl_Chart.h module, and it seems to compiled without problems, as long as you set the correct paths for the include and lib files. I also succeeded, finally, in compiling and testing the wxWindows and wxWidgets, which further increased my weaponry in the GUI area. I also tried the Winbgi lybrary, and it also compiles OK. You have to include the source file to the project and it would work smoothly. I didn't have the same luck with the SDL library though, but I don"t need that for the moment, so I think I btter concentrate on more concrete coding.This just to report my own experiences regarding compilation of soem of the devpaks currently available. By the way, I used the update feature to download all available packages, and them select those I wanted to try. At this pace, Dev-C++ might turn into a nice alternative to C++Builder, Delphi, etc, in term of RAD, particularly the development of GUIs. Some extra work, but it always help to go back to the basics or its surroundings...

      Greeings, VH

       
    • Jim W.

      Jim W. - 2004-09-25

      I don't think there's a way to fix that problem; seems to be fundamental build incompatibility. Guess it's time to update:

      http://www.fltk.net/

      Look for "FLTK2 Dev-C++ Package..."

      On a quick test here (Dev 4.9.9.0, WinMe), it seems to work....

      -- Jim.

       
    • Nobody/Anonymous

      THANKS!!!! IT WORKS!!!

      To help other beginners:
      DON'T use update to install FLTK devpack. get it from http://www.fltk.net.

       
    • Wayne Keen

      Wayne Keen - 2004-09-25

      Cool, sometimes it works out best when the wife has a long "honey-do" list!

      Wayne

       
    • Jim W.

      Jim W. - 2004-09-26

      The Dev-C++ 4.9.9.0 "package" release updated the "default" compiler set to MinGW GCC 3.3.1, from 3.2. That's good.

      Unfortunately, some "current" DevPaks are (MinGW GCC) "version-sensitive".

      Just did a quick test of FLTK2 (using Dev 4.9.9.0) with MinGW GCC 3.4.2 Release Candidate (configured as a Dev [external] compiler set) and it "seems to work".

      That's good, too....

      -- Jim.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.