|
在Windows下Qt Creator编程环境使用QextSerialPort编写串口时遇到了问题,请大家多多帮忙!在线等。。。
[复制链接]
问题:在Windows下Qt Creator编程环境使用QextSerialPort编写串口时遇到了问题,具体信息见下:
release/serialtest.o:serialtest.cpp::-1: error: undefined reference to `QextSerialPort::QextSerialPort()'
release/serialtest.o:serialtest.cpp::-1: error: undefined reference to `QextSerialPort::QextSerialPort()'
:-1: error: collect2: ld returned 1 exit status
源码:serialtest.c
#include "serialtest.h"
#include "ui_serialtest.h"
//qiang
//#include
//#include
//#include "qextserialenumerator.h"
#include
#include
SerialTest::SerialTest(QWidget *parent)
: QDialog(parent), ui(new Ui::SerialTest)
{
ui->setupUi(this);
//qiang initial
ui->textEdit_RXdata->setUpdatesEnabled(true); //更新数据接收区
mycomm = new QextSerialPort();
}
SerialTest::~SerialTest()
{
delete ui;
}
void SerialTest::on_pushButton_open_close_clicked()
{
/*
if(mycomm->isOpen())
{
//mycomm->close();
//ui->pushButton_open_close->setText(QString::fromLocal8Bit("打开串口(&O)"));
}
else
{
mycomm->setPortName(ui->comboBox_ComNum->currentText());
mycomm->open(QextSerialPort::ReadWrite);
if (!mycomm->isOpen())
{
QMessageBox::critical(this, QString::fromLocal8Bit("错误"),
QString::fromLocal8Bit("无法打开串口: ") + mycomm->portName()
+ QString::fromLocal8Bit("\n指定的串口不存在或者被占用。"));
ui->pushButton_open_close->setText(QString::fromLocal8Bit("打开串口(&O)"));
}
else
{
ui->pushButton_open_close->setText(QString::fromLocal8Bit("关闭串口(&O)"));
}
}
*/
}
serialtest.h
#ifndef SERIALTEST_H
#define SERIALTEST_H
#include
//#pragma comment( lib, "Advapi32.lib" )
//qiang
#include
//#include "qextserialport.h"
namespace Ui
{
class SerialTest;
}
class SerialTest : public QDialog
{
Q_OBJECT
public:
SerialTest(QWidget *parent = 0);
~SerialTest();
private:
Ui::SerialTest *ui;
//qiang
QextSerialPort *mycomm;
//Win_QextSerialPort *mycomm;
private slots:
void on_pushButton_open_close_clicked();
};
#endif // SERIALTEST_H
|
|