看了论坛上的教程,自己学着对串口控制。使用QT3 designer写了一个QT串口的小测试程序。一编译出了一大堆错误。。。请各位大大给点建议。代码如下 附图2张(图1,界面。图2,3错误信息)red hat9系统。
#include <form2.h>
#include <qextserialport.h>
#include <posix_qextserialport.h>
Posix_QextSerialPort *myCom;
void Form2::openMycom()
{
myCom = new Posix_QextSerialPort("/dev/ttys0",QextSerialBase::Polling);
myCom->open(QIODevice::ReadWrite);
}
void Form2::readMycom()
{
QByteArray temp = myCom->readAll();
this->lineEdit17->setText(temp);
}
void Form2::closeMycom()
{
myCom->close();
}
void Form2::senddata()
{
myCom->setBaudRate(BAUD19200);
myCom->setFlowControl(FLOW_OFF);
myCom->setParity(PAR_NONE);
myCom->setDataBits(DATA_8);
myCom->setStopBits(STOP_1);
myCom->setTimeout(5,0);
myCom->write(this->lineEdit18->text().toAscii());
}