[gtkmm] Re: compiling gtkmm



I am still having problems trying to compile and run the tutorial using 
gtkmm2.4 on debian - I have the following questions - can someone help?
1) Is there a reason gtkmm only accepts #include "logindialog.h" and does not 
accept #include <logindialog.h> (I thought brackets were the preferred way to 
use include files)
2) I get the following "undefined reference" errors:
sh-2.05b$ export LD_LIBRARY_PATH=/usr/local/lib/sbin/ldconfig sh-2.05b$ g++ 
mainprogram.cpp -o mainprogram `pkg-config gtkmm-2.4 --cflags --libs`
mainprogram.cpp:9:2: warning: no newline at end of file
/tmp/cc0xCX10.o(.text+0x3c): In function `main':
: undefined reference to `LoginDialog::LoginDialog[in-charge]()'
/tmp/cc0xCX10.o(.text+0x52): In function `main':
: undefined reference to `LoginDialog::~LoginDialog [in-charge]()'
/tmp/cc0xCX10.o(.text+0x77): In function `main':
: undefined reference to `LoginDialog::~LoginDialog [in-charge]()'
collect2: ld returned 1 exit status
sh-2.05b$

//**********  mainprogram.cpp ************************** 
#include <gtkmm/main.h>
#include "logindialog.h"

int main(int argc, char* argv[]) {
	Gtk::Main kit(argc, argv);
	LoginDialog loginDialog;
	Gtk::Main::run(loginDialog);
	return 0;
}
//************ logindialog.h ******************************
#ifndef GTKMM_LOGIN_H
#define GTKMM_LOGIN_H

#include <gtkmm/window.h>
#include <gtkmm/button.h>

class LoginDialog : public Gtk::Window {

public:
	LoginDialog();
	virtual ~LoginDialog();
	
protected:
	virtual void okayButtonClicked();
	
	//---- widgets ----
	Gtk::Button okayButton;
};
#endif // GTKMM_LOGIN_H

//************************** logindialog.cpp ********************
#include "logindialog.h"
#include <iostream>

LoginDialog::LoginDialog() : okayButton("Okay") {
	set_border_width(10);
	okayButton.signal_clicked().connect(sigc::mem_fun(*this, 
&LoginDialog::okayButtonClicked));
	add(okayButton);
	okayButton.show();
}
LoginDialog::~LoginDialog() {
}
void LoginDialog::okayButtonClicked() {
	std::cout << "Welcome" << std::endl;
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]