compile error

Hi,

Can someone tell me how to solve this problem?
The error is generated by g++ on linux(ubuntu).
1
2
main.o: In function `main':
main.cpp:(.text+0x62): undefined reference to `controller::controller()'


This is the code:



1
2
3
4
5
6
7
8
9
10
11
12
/*main.cpp*/

#include <iostream>
#include <QtGui/QApplication>

#include "controller.hpp"

int main( int argc, char* argv[] ) {
	QApplication app( argc, argv );
	controller ();
	return app.exec();
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*controller.hpp*/
#ifndef CONTROLLER_HPP
#define CONTROLLER_HPP

#include <QtGui/QTableWidget>

class controller {
	
public: 
	
	controller( );
private:
	QTableWidget* widget;
};
#endif 

1
2
3
4
5
6
7
/*controller.cpp*/
#include "controller.hpp"

controller::controller( ) {
	widget = new QTableWidget(5,5);
	widget.show();
}


thanks.


you need to link it with controller.cpp.
compile it like this:
g++ main.cpp controller.cpp -o main
Thansk for reply, but i already solved
the problem by rerunning qmake -project.

i'll close this tread

hannesvdc
Topic archived. No new replies allowed.