我正在研究qwt和qextserialport示例。 到目前为止我做了什么,我已经采用示波器示例并添加了打开和配置端口的行。当我编译代码时,编译器会出现以下错误。 这是编译器输出:
12:21:41: Running build steps for project oscilloscope...
12:21:41: Configuration unchanged, skipping qmake step.
12:21:41: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug all
mingw32-make.exe[1]: Entering directory `C:/Users/Edgaras/Downloads/qwt-6.0.0-rc5/examples/oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug'
compiling ../oscilloscope/main.cpp
linking ..\..\examples\bin\oscilloscope.exe
mingw32-make.exe[1]: Leaving directory `C:/Users/Edgaras/Downloads/qwt-6.0.0-rc5/examples/oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug'
./debug\main.o: In function `Z5qMainiPPc':
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:33: undefined reference to `QextSerialPort::QextSerialPort(QString const&, QextSerialPort::QueryMode, QObject*)'
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:42: undefined reference to `QextSerialPort::setBaudRate(BaudRateType)'
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:43: undefined reference to `QextSerialPort::setQueryMode(QextSerialPort::QueryMode)'
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:44: undefined reference to `QextSerialPort::setFlowControl(FlowType)'
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:45: undefined reference to `QextSerialPort::setParity(ParityType)'
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:46: undefined reference to `QextSerialPort::setDataBits(DataBitsType)'
C:\Users\Edgaras\Downloads\qwt-6.0.0-rc5\examples\oscilloscope-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug/../oscilloscope/main.cpp:47: undefined reference to `QextSerialPort::setStopBits(StopBitsType)'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [..\..\examples\bin\oscilloscope.exe] Error 1
mingw32-make.exe: *** [debug-all] Error 2
12:21:43: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project oscilloscope (target: Desktop)
When executing build step 'Make'
这是我的代码:
oscilloscope.pri
include( C:\DIR\qwt-6.0.0-rc5\examples\examples.pri )
include(C:\DIR\qextserialport-1.2rc\qextserialport-1.2rc\src\qextserialport.pri)
的main.cpp
int main(int argc, char **argv)
{
QApplication app(argc, argv);
MainWindow window;
window.resize(800,400);
SamplingThread samplingThread;
samplingThread.setFrequency(window.frequency());
samplingThread.setAmplitude(window.amplitude());
samplingThread.setInterval(window.signalInterval());
window.connect(&window, SIGNAL(frequencyChanged(double)),
&samplingThread, SLOT(setFrequency(double)));
window.connect(&window, SIGNAL(amplitudeChanged(double)),
&samplingThread, SLOT(setAmplitude(double)));
window.connect(&window, SIGNAL(signalIntervalChanged(double)),
&samplingThread, SLOT(setInterval(double)));
window.show();
samplingThread.start();
window.start();
bool ok = app.exec();
QextSerialPort* port = new QextSerialPort("COM11"); //we create the port
port->open(QIODevice::ReadWrite); //we open the port
if(!port->isOpen())
{
//QMessageBox::warning(this, "port error", "Impossible to open the port!");
}
//we set the port properties
port->setBaudRate((BaudRateType)460800); //modify the port settings on your own
port->setQueryMode(QextSerialPort::EventDriven);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_1);
// port->setTimeout(500);
samplingThread.stop();
samplingThread.wait(1000);
return ok;
如果有人可以提供帮助,我会很有帮助,我无法弄清楚出了什么问题。
最好的问候
Edgaras