Hello, I am getting this error, (Linking error, according to what I have read), but I can't figure out how to fix it.
RoboSearch.cpp: undefined reference to `compare::searchTwo(QString, QString, QString)'
To copy to clipboard, switch view to plain text mode
Most people seem to have this trouble when they don't add the .cpp and .h in the .pro file, but I have. I am using Qt 4 on windows with VS C++ 2005 express, and am using VS to build the project.
qmake –project
qmake
make clean
make release
This is the function in the class RoboSearch that is calling a method from another class.
void RoboSearch::Compare()
{
compare *comp = new compare;
comp->show();
compare::searchTwo("B enrichment - MP - km2.xml", "B Enrichment MP 10-10-5.xml", directory);
}
void RoboSearch::Compare()
{
compare *comp = new compare;
comp->show();
compare::searchTwo("B enrichment - MP - km2.xml", "B Enrichment MP 10-10-5.xml", directory);
}
To copy to clipboard, switch view to plain text mode
This is the class declartion of compare in compare.h
class compare
: public QMainWindow,
private Ui
::compare{
Q_OBJECT
public:
};
class compare : public QMainWindow, private Ui::compare
{
Q_OBJECT
public:
compare(QMainWindow *parent = 0);
static void searchTwo(QString protocol1, QString protocol2, QString directory);
};
To copy to clipboard, switch view to plain text mode
And for good measure, here is the .pro file.
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += xml
CONFIG += console
RC_FILE = RoboSearch.rc
# Input
HEADERS += compare.h DOM.h readme.h RoboDOM.h RoboSearch.h
FORMS += compare.ui readme.ui RoboSearch.ui
SOURCES += compare.cpp DOM.cpp main.cpp readme.cpp RoboDOM.cpp RoboSearch.cpp
RESOURCES += RoboSearch.qrc
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += xml
CONFIG += console
RC_FILE = RoboSearch.rc
# Input
HEADERS += compare.h DOM.h readme.h RoboDOM.h RoboSearch.h
FORMS += compare.ui readme.ui RoboSearch.ui
SOURCES += compare.cpp DOM.cpp main.cpp readme.cpp RoboDOM.cpp RoboSearch.cpp
RESOURCES += RoboSearch.qrc
To copy to clipboard, switch view to plain text mode
I am new to Qt, and fairly new to programming in general.... Any idea what I'm doing wrong? Thanks!
Bookmarks