Cannot able to display the comports availability in the combobox
I am trying to display the comports availability in the system to be displayed in the combobox. it show some errors..
as shown below
D:\New Folder\untitled-build-desktop\..\untitled\mainwindow.cpp:35: error: undefined reference to `SerialDeviceEnumerator::instance()'
D:\New Folder\untitled-build-desktop\..\untitled\mainwindow.cpp:37: error: undefined reference to `SerialDeviceEnumerator::devicesAvailable() const'
I have used serialdeviceenumerator and abstract serial classes and i have attached my code also. kindly any one help me and replies are appreciated.
Untitled .h
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtGui>
#include <QWidget>
#include <abstractserial.h>
class SerialDeviceEnumerator;
class AbstractSerial;
namespace Ui {
class MainWindow;
}
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private slots:
void initenum();
private:
Ui::MainWindow *ui;
SerialDeviceEnumerator *m_sde;
//AbstractSerial *serial;
};
untitled.cpp
Code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtGui>
#include <QtCore/QDebug>
#include <QtCore/QStringList>
#include <iostream>
#include <serialdeviceenumerator.h>
#include <abstractserial.h>
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
initenum();
// this->m_sde = new SerialDeviceEnumerator(this);
// this->m_sde->setEnabled(true);
// QStringList devList = m_sde->devicesAvailable();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::initenum()
{
this->m_sde = SerialDeviceEnumerator::instance();
this->on_comboBox_textChanged(this->m_sde->devicesAvailable());
}
void MainWindow
::on_comboBox_textChanged(const QStringList &arg1
) {
cmbPorts->clear();
cmbPorts->addItems(arg1);
}
Re: Cannot able to display the comports availability in the combobox
Uncheck option "Shadow Build" in QtCreator (if you build with it).
In .pro file HEADERS += serialdeviceenumerator.h abstractserial.h SOURCES += serialdeviceenumerator.cpp abstractserial.cpp
Re: Cannot able to display the comports availability in the combobox
i have unchecked that shadow build option but still i couldn't get it.
Re: Cannot able to display the comports availability in the combobox
Add the library containing the implementation of SerialDeviceEnumerator and AbstractSerial to your LIBS variable.