Re: [gnomemm] More Help Needed
- From: Dennis Möhlmann <spam darksaidin de>
- To: gnomemm-list gnome org
- Subject: Re: [gnomemm] More Help Needed
- Date: Sat, 14 Feb 2004 12:59:42 +0100
Just a wild guess: have you maybe forgotten to link GnuMu.o along with
main.o ? You need to link both files, otherwise references from main.o
to GnuMu.o (where gnumu is implemented) are not satisfied.
C++ is unfortunatly won't do it for you.
Best regards,
Dennis.
Am Sa, den 14.02.2004 schrieb Dan Pixley um 07:01:
> Hi all. Another newb question for you here. I am just learning Gtkmm
> and glade--, and am having problems getting my test program to link.
> compiling with "g++ main.cc -o gnumu `pkg-config gtkmm-2.0
> libglademm-2.0 --cflags --libs`", I get three errors saying:
>
> "/tmp/ccrs09HB.o(.text+0x35): In function `main': : undefined reference
> to `gnumu::gnumu[in-charge]()'"
>
> The other two errors are similar and complain about "gnumu::~gnumu
> [in-charge]()". Here are my files:
>
> GnuMu.h:
>
> #ifndef GNUMU_H
> #define GNUMU_U
>
> #include <gtkmm.h>
> #include <libglademm.h>
>
> class gnumu : public Gtk::Window
> {
> public:
> gnumu ();
> virtual ~gnumu ();
>
> protected:
> // Connect to a new world.
> // Test: outputs "Connecting World1" to
> virtual void on_connect_activate ();
> // When the enter key is pressed in the text inputbox.
> // Test: outputs entered text to output textbox
> virtual void on_input_entry_key_release_event ();
> // When button is pressed, world is activated in textbox.
> virtual void on_button1_clicked ();
>
> // MenuBar.
> Gtk::MenuBar menu_Bar;
> Gtk::Menu menu_File, menu_Edit;
> Gtk::Menu menu_Connect, menu_Quit; //submenus.
> // Buttons. Only first two buttons implemented for testing.
> Gtk::Button button1;
> Gtk::Button button2;
> // Output and input textboxs.
> Gtk::TextView* output_textview;
> Gtk::Entry* input_entry;
>
> Glib::RefPtr<Gnome::Glade::Xml> xml_interface;
> };
>
> #endif
>
>
> GnuMu.cc:
> #include <iomanip>
> #include <sstream>
>
> #include <sigc++/retype_return.h>
>
> #include "GnuMu.h"
>
> #include <iostream>
>
> gnumu::gnumu()
> {
> set_title ("GnuMU");
> set_resizable (true);
>
> xml_interface = Gnome::Glade::Xml::create ("gnumu.glade");
> xml_interface->reparent_widget ("vbox1", *this);
>
> xml_interface->get_widget ("menu_Bar", menu_Bar);
> xml_interface->get_widget ("menu_File", menu_File);
> xml_interface->get_widget ("menu_Edit", menu_Edit);
> xml_interface->get_widget ("menu_Connect", menu_Connect);
> xml_interface->get_widget ("menu_Quit", menu_Quit);
> xml_interface->get_widget ("button1", button1);
> xml_interface->get_widget ("button2", button2);
> xml_interface->get_widget ("output_textview", output_textview);
> xml_interface->get_widget ("input_entry", input_entry);
>
> menu_Connect->signal_clicked().connect (SigC::slot(*this,
> &gnumu::on_connect_activate));
> menu_Quit->signal_clicked().connect (SigC::slot(*this,
> &gnumu::hide));
> button1->signal_clicked().connect (SigC::slot(*this,
> &gnumu::on_button1_clicked));
> button2->signal_clicked().connect (SigC::slot(*this,
> &gnumu::on_button1_clicked));
> //input_entry->signal??? (SigC::slot(*this,
> &gnumu::on_input_key_release));
> }
>
> gnumu::~gnumu()
> {
> }
>
> void gnumu::on_connect_activate ()
> {
> Gtk::InputDialog dialog(*this, "Enter IP and port (Example:
> 192.168.1.1:1234)", Gtk::MESSAGE_QUESTION,
> (Gtk::ButtonType)(Gtk::BUTTONS_OK | Gtk::BUTTONS_CANCEL));
> int result = dialog.run
>
> switch(result)
> {
> case (Gtk::RESPONSE_OK):
> {
> std::cout << "OK clicked." << std::endl;
> break;
> }
> case (Gtk::RESPONSE_CANCEL);
> {
> std::cout << "Cancel clicked." << std::endl;
> break;
> }
> default:
> {
> std::cout << "Unexepcted button clicked." << std::endl;
> break;
> }
> }
> }
>
> void gnumu::on_input_entry_key_release_event ()
> {
> std::cout << "test";
> }
>
> void gnumu::on_button1_clicked ()
> {
> std::cout << "test";
> }
>
> Main.cc:
>
> #include <gtkmm.h>
> #include "GnuMu.h"
>
> int main(int argc, char *argv[])
> {
> Gtk::Main kit(argc, argv);
>
> gnumu window;
> kit.run(window);
>
> return 0;
> }
>
> ------------------------------------------------------------
>
> Note that you cannot compile this without the .glade file. I am also
> aware that there are probably lots of other bugs in this code, but I am
> stuck on this first one, and need some help working through it. Also, I
> prefer to use the g++ command instead of autoconf and automake just so I
> get a feel for that compiler (and I need to learn autoconf and automake
> as well. One thing at a time though.). I'm new to lots of this stuff.
> :) If anyone can spot my linking error, please let me know.
>
> Thanks in advance,
> Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]