Solved problem on making an object
-
hello
I want to make an object ofQModbusClient
in my Code. I have added these to my code:
Header: #include <QModbusClient> qmake: QT += serialbus
when I use this code in my *.h file:
QModbusClient *ModbusObject;
Receive No Error but if use this:
QModbusClient *ModbusObject = new QModbusClient();
Receive ERROR:
...\mainwindow.h:31: error: invalid new-expression of abstract class type 'QModbusClient' QModbusClient *ModbusObject = new QModbusClient();
^
why?
-
@rezaMSLM As the error message says: QModbusClient is an abstract class.
See https://doc.qt.io/qt-5/qmodbusclient.html#details
You can create instances of QModbusRtuSerialMaster and QModbusTcpClient.