[Solved]obdii.cpp:118: error: undefined reference to
-
Thank you in advance for your help.
I receige the following message when I compile.
obdii.h
@#ifndef OBDII_H
#define OBDII_H#include <QtWidgets/QtWidgets>
#include <QtWidgets/QDialog>
#include <QtCore>
#include <QtGui>class QLabel;
class QLineEdit;
class QPushButton;
class QTreeViewWidget;
class QListWidget;class obdiiDlg : public QDialog
{
Q_OBJECTvoid AddRoot(QString Name, QString Description); void AddChild(QTreeView *parent, QString Name, QString Description);
public:
obdiiDlg(QWidget *parent = 0);signals:
void getDTC(const QString &str, Qt::CaseSensitivity cs);
void getPIDData(const QString &str, Qt::CaseSensitivity cs);
void clearMIL(const QString &str, Qt::CaseSensitivity cs);
void printReport(const QString &str, Qt::CaseSensitivity cs);
void goOnline(const QString &str, Qt::CaseSensitivity cs);
void sendData(const QString &str, Qt::CaseSensitivity cs);private slots:
void btnGetDTCClicked();
void btnGetPIDDataClicked();
void btnClearMILClicked();
void btnGoOnlineClicked();
void btnSendDataClicked();
void btnPrintClicked();private:
QLabel *lblMessage;
QLabel *lblPIDSelection;QLabel *lblPIDData; QTreeWidget *treePIDData; QPushButton *btnGetDTC; QLabel *lblSendData; QLineEdit *editSendData; QLabel *lblReadData; QLineEdit *editReadData;
};
#endif // OBDII_H
@@#include <QtGui>
#include "obdii.h"obdiiDlg::obdiiDlg(QWidget *parent)
:QDialog(parent)
{
lblMessage = new QLabel(tr("Message"));lblPIDData = new QLabel(tr("PID data")); treePIDData = new QTreeWidget; lblPIDData->setBuddy(treePIDData); connect(btnGetDTC, SIGNAL(clicked()), this, SLOT(btnGetDTCClicked())); QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout->addWidget(lblPIDData); leftLayout->addWidget(treePIDData); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addLayout(leftLayout); setLayout(mainLayout); setWindowTitle("OBDII"); setLayout(mainLayout);
}
main.cpp
#include <QtWidgets/QApplication>#include "obdii.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
obdiiDlg *dialog = new obdiiDlg;
dialog->show();
a.exec();
}
@obdii.pro
@HEADERS +=
obdii.hFORMS +=
SOURCES +=
obdii.cpp
main.cppQT += widgets
@
-
Hi and welcome to devnet,
From the code you posted, the problem is that you don't implement any of the slots from the class.
-
Are you saying that if I define a slot in a class, I must also define the function?
Are there 'cliff notes' for using classes?
Thanks
-
Yes, you must implement the slots, only signals have no implementation.
"Signals & Slots documentation":http://qt-project.org/doc/qt-4.8/signalsandslots.html
-
You rock! How do I mark a post as solved
I will get much use out of this forum. -
:)
You just have to edit your first post and update the title