fehlermeldung



  • hallo
    ich versuche mein programm zu compilieren mit c++, so heisst der compiler(!), ich bekomme folgende fehlermeldung:

    window2.o: In function window2::window2(int)': /srv/home/ea/work2/window2.cc:80: undefined reference towindow2::SigC::ObjectScoped virtual table'
    /srv/home/ea/work2/window2.cc:80: undefined reference to window2 virtual table' window2.o: In functionwindow2::~window2(void)':
    /srv/home/ea/work2/window2.cc:144: undefined reference to window2 virtual table' /srv/home/ea/work2/window2.cc:144: undefined reference towindow2::SigC::ObjectScoped virtual table'
    collect2: ld returned 1 exit status
    make: *** [camcalb] Error 1

    ich glaube, das programm stimmt, aber trotzdem kommt das da, woran könnte es liegen?

    das ist die klasse:

    #include "camdata.hh"
    #include "window2.hh"
    #include "window1.hh"
    
    gint delete_event_impl(GdkEventAny*)
    {
        Gtk::Main::quit();
        return 0;
    }
    
    /
    
    window2::window2(
    ) : Gtk::Window(GTK_WINDOW_TOPLEVEL)
    {
    
       Gtk::Window *window2 = this;
       Gtk::MenuItem *new_pic_serie1 = manage(new class Gtk::MenuItem("New Pic. Serie"));
       Gtk::MenuItem *exit1 = manage(new class Gtk::MenuItem("Exit"));
       Gtk::Menu *file1_menu = manage(new class Gtk::Menu());
       Gtk::MenuItem *file1 = manage(new class Gtk::MenuItem("File"));
       Gtk::MenuItem *help2 = manage(new class Gtk::MenuItem("Help"));
       Gtk::MenuItem *about1 = manage(new class Gtk::MenuItem("About..."));
       Gtk::Menu *help1_menu = manage(new class Gtk::Menu());
       Gtk::MenuItem *help1 = manage(new class Gtk::MenuItem("Help"));
       Gtk::MenuBar *menubar1 = manage(new class Gtk::MenuBar());
       Gtk::Pixmap *pixmap1 = manage(new class Gtk::Pixmap());
       Gtk::HBox *hbox1 = manage(new class Gtk::HBox(false, 0));
       Gtk::Button *button1 = manage(new class Gtk::Button("button1"));
       Gtk::Button *button2 = manage(new class Gtk::Button("button2"));
       Gtk::Button *button3 = manage(new class Gtk::Button("button3"));
       Gtk::HButtonBox *hbuttonbox1 = manage(new class Gtk::HButtonBox(GTK_BUTTONBOX_DEFAULT_STYLE, 30));
       Gtk::VBox *vbox1 = manage(new class Gtk::VBox(false, 0));
    
       file1_menu->append(*new_pic_serie1);
       file1_menu->append(*exit1);
       file1->set_submenu(*file1_menu);
       help1_menu->append(*help2);
       help1_menu->append(*about1);
       help1->set_submenu(*help1_menu);
       menubar1->append(*file1);
       menubar1->append(*help1);
       pixmap1->set_alignment(0.5, 0.5);
       pixmap1->set_padding(0, 0);
       hbox1->pack_start(*pixmap1);
       hbuttonbox1->set_border_width(13);
       hbuttonbox1->pack_start(*button1);
       hbuttonbox1->pack_start(*button2);
       hbuttonbox1->pack_start(*button3);
       vbox1->pack_start(*menubar1, false, false, 0);
       vbox1->pack_start(*hbox1);
       vbox1->pack_start(*hbuttonbox1, false, false, 0);
       window2->set_title("window2");
       window2->add(*vbox1);
       new_pic_serie1->show();
       exit1->show();
       file1_menu->show();
       file1->show();
       help2->show();
       about1->show();
       help1_menu->show();
       help1->show();
       menubar1->show();
       pixmap1->show();
       hbox1->show();
       button1->show();
       button2->show();
       button3->show();
       hbuttonbox1->show();
       vbox1->show();
       window2->show();
       new_pic_serie1->activate.connect(SigC::slot(static_cast<class window2*>(this), &window2::on_new_pic_serie1_activate));
       exit1->activate.connect(SigC::slot(static_cast<class window2*>(this), &window2::on_exit1_activate));
       help2->activate.connect(SigC::slot(static_cast<class window2*>(this), &window2::on_help2_activate));
       about1->activate.connect(SigC::slot(static_cast<class window2*>(this), &window2::on_about1_activate));
    }
    
    window2::~window2()
    {
    }
    

    headerdatei:

    #ifndef _WINDOW2_HH
    #define _WINDOW2_HH
    
    #include <iostream.h>
    #include <gtk--/box.h>
    #include <gtk--/button.h>
    #include <gtk--/main.h>
    #include <gtk--/window.h>
    #include <gtk--/list.h>
    #include <gtk--/menu.h>
    #include <gtk--/menubar.h>
    #include <gtk--/pixmap.h>
    #include <gtk--/buttonbox.h>
    
    #include <gtk--/checkbutton.h>
    #include <gtk--/entry.h>
    
    class window2 : public Gtk::Window //, camdata
    {
      public:
    
        void on_new_pic_serie1_activate();
        void on_exit1_activate();
        void on_help2_activate();
        void on_about1_activate();
        gint delete_event_impl(GdkEventAny*);
    
        //Gtk::Window *window1 = this;
        Gtk::MenuItem ;
        Gtk::MenuItem ;
        Gtk::Menu ;
        Gtk::MenuItem ;
        Gtk::MenuItem ;
        Gtk::MenuItem ;
        Gtk::Menu ;
        Gtk::MenuItem;
        Gtk::MenuBar;
        Gtk::Pixmap ;
        Gtk::HBox ;
        Gtk::Button;
        Gtk::Button;
        Gtk::Button ;
        Gtk::HButtonBox ;
        Gtk::VBox ;
    
        window2();
        ~window2();
    };
    #endif
    

    danke



  • hi

    eine sache habe ich dazu gefunden, weils mich interessiert hat, kann ja sein, daß es weiterhilft...:

    frage hier:
    [sigc] undefined reference to `Sim::SigC::ObjectScoped virtual table'
    http://www.geocrawler.com/archives/3/3727/2001/1/0/5017329/

    antwort dort:
    http://www.geocrawler.com/archives/3/3727/2001/1/0/5019273/

    This sounds a bit like a problem with where the vtable got
    put. On some versions of gcc I have noticed that if you do
    not declare and define the dtor of a class which uses sigc++
    it returns such an error.

    Try adding a dtor to your class (both the signal user and
    the signal receiver) and see if that clears things up.
    The dtor should not be inline. It must appear in a .cc
    file so that the compiler knows which object file to
    place the vtable.

    Hope it helps.

    --Karl


Anmelden zum Antworten