PDA

View Full Version : Undefined reference



Salazaar
19th May 2007, 21:39
Hi. I've got a problem. When I tried to compile the program, there appear error:
undefined reference to 'abcziom()' in maker.cpp. Here are those two files:
Maker.cpp

#include <QtGui>

#include "maker.h"

MainWindow::MainWindow(QMainWindow *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
void MainWindow::abcziom()

{


}

Maker.h

#ifndef MAKER_H
#define MAKER_H

#include "ui_maker.h"


class MainWindow : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT

public:
MainWindow(QMainWindow *parent = 0);

private slots:

void abcziom();

private:

Ui::MainWindow ui;
};

#endif


Main.cpp, and ui_maker.h which I won't post, becauce is not problematic relationship. I really don't know what is this error about. Regards

jpn
19th May 2007, 23:05
Are both files (Maker.h and Maker.cpp) listed in .pro?

Salazaar
19th May 2007, 23:18
yes, they are

jpn
20th May 2007, 07:00
Add

#endif // MAKER_H
at the end of maker.h.

marcel
20th May 2007, 07:57
Add

#endif // MAKER_Hat the end of maker.h.

Isn't "#endif" already there?
Anyway, make sure maker.h is moc'ed,

Regards

jpn
20th May 2007, 07:59
Isn't "#endif" already there?
Heh, you're right. I managed to miss it, sorry. :)

Edit: Salazaar, could you show us your .pro file?

Salazaar
20th May 2007, 17:54
Sure.

################################################## ####################
# Automatically generated by qmake (2.01a) N 13. maj 20:51:00 2007
################################################## ####################

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

# Input
RESOURCES = images.qrc
HEADERS += maker.h ui_maker.h ui_about.h
SOURCES += main.cpp maker.cpp

jacek
20th May 2007, 18:04
HEADERS += maker.h ui_maker.h ui_about.h
It should be:

HEADERS += maker.h
FORMS += maker.ui about.ui
This way qmake will generate ui_*.h file automatically every time you change the .ui file.

Salazaar
20th May 2007, 18:11
This was created by qmake. And I was trying to compile other applications this qmake system and it was ok

wysota
20th May 2007, 20:00
You should create project files with qmake before you start compilation, not after that. Then only update the file manually.

Salazaar
21st May 2007, 06:56
Sure I create project file before compiling, that's the procedure.

wysota
21st May 2007, 07:56
If you did, you wouldn't end up with ui_*.h files in it as these are created by uic during compilation. Unless of course you added them manually.

Salazaar
23rd May 2007, 10:21
I've solved the problem (I don't know exactly how) but I still don't understand what was the problem about. I've got all my files and run qmake-project