0

Hi thank you all for your time, simple scada doesn't want to compile -> empty project or their sample project called Weather https://github.com/IndeemaSoftware/QSimpleScadaSample. I install lib via git and qpm but issues of lack of proper members in classes during the compilation stay the same. I really appreciate any kind of help because I'm really stuck Highest Regards

About QT version Qt Creator 5.0.1 Based on Qt 5.15.2 (MSVC 2019, 64 bit) Built on Sep 14 2021 01:17:14 From revision 7e965629b0

About compiler's version mingw 8.1.0 64

Error logs debug\qscadaboard.o ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboard.cpp g++ -c -fno-keep-inline-dllexport -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQPM_INIT(E)="E.addImportPath(QStringLiteral("qrc:/"));" -DQPM_USE_NS -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICKWIDGETS_LIB -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Weather -I. -I../../Qt/libs/vendor -I../../Qt/libs/vendor/com/indeema/qsimplescada -IC:/Qt/6.2.0/mingw81_64/include -IC:/Qt/6.2.0/mingw81_64/include/QtQuickWidgets -IC:/Qt/6.2.0/mingw81_64/include/QtQuick -IC:/Qt/6.2.0/mingw81_64/include/QtOpenGL -IC:/Qt/6.2.0/mingw81_64/include/QtWidgets -IC:/Qt/6.2.0/mingw81_64/include/QtGui -IC:/Qt/6.2.0/mingw81_64/include/QtQmlModels -IC:/Qt/6.2.0/mingw81_64/include/QtQml -IC:/Qt/6.2.0/mingw81_64/include/QtNetwork -IC:/Qt/6.2.0/mingw81_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.2.0/mingw81_64/mkspecs/win32-g++ -o debug\qscadaboardcontroller.o ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboardcontroller.cpp ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboardcontroller.cpp: In member function 'void QScadaBoardController::openProject(QString)': ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboardcontroller.cpp:264:28: error: 'class QTextStream' has no member named 'setCodec' lStreamFileOut.setCodec("UTF-8"); ^~~~~~~~ ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboardcontroller.cpp: In member function 'void QScadaBoardController::saveProject(QString)': ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboardcontroller.cpp:315:18: error: 'class QTextStream' has no member named 'setCodec' lOut.setCodec("UTF-8"); ^~~~~~~~ ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboard.cpp: In member function 'virtual void QScadaBoard::mousePressEvent(QMouseEvent*)': ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboard.cpp:112:14: error: invalid use of incomplete type 'class QMouseEvent' if (event->button() == Qt::LeftButton) { ^~ In file included from C:/Qt/6.2.0/mingw81_64/include/QtWidgets/QWidget:1, from ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard../QScadaObject/qscadaobject.h:6, from ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboard.h:4, from ....\Qt\libs\vendor\com\indeema\qsimplescada\QScadaBoard\qscadaboard.cpp:1: C:/Qt/6.2.0/mingw81_64/include/QtWidgets/qwidget.h:73:7: note: forward declaration of 'class QMouseEvent' class QMouseEvent; ^~~~~~~~~~~ mingw32-make[1]: *** [Makefile.Debug:2090: debug/qscadaboardcontroller.o] Error 1 mingw32-make[1]: *** Waiting for unfinished jobs.... mingw32-make[1]: *** [Makefile.Debug:1910: debug/qscadaboard.o] Error 1 mingw32-make[1]: Leaving directory 'E:/Dokumenty/AiR_rok_4/S7/EngineeringThesis/QSimpleScadaSample-master/build-Weather-Desktop_Qt_6_2_0_MinGW_64_bit-Debug' mingw32-make: *** [Makefile:45: debug] Error 2 10:09:02: The process "C:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project Weather (kit: Desktop Qt 6.2.0 MinGW 64-bit) When executing step "Make" 10:09:02: Elapsed time: 00:05.

My Weather.pro file

#-------------------------------------------------
#
# Project created by QtCreator 2019-07-24T19:14:55
#
#-------------------------------------------------

QT       += core gui network qml quick quickwidgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

include (E:/Dokumenty/AiR_rok_4/S7/EngineeringThesis/Qt/libs/vendor/vendor.pri)

TARGET = Weather
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact waenter code herernings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

CONFIG += c++11

SOURCES += \
        main.cpp \
        mainwindow.cpp

HEADERS += \
        mainwindow.h

FORMS += \
        mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

DISTFILES +=

  [1]: https://i.stack.imgur.com/6sCFn.png
Gameriker
  • 35
  • 7
  • Please add the complete error message. What is the version of Qt that you use? Compiler? What have you changed in the original `*.pro` file? – zkoza Oct 20 '21 at 22:12
  • thank you for your comment, I added mentioned information to main post's content. Only think I changed was path to file vendor.pi – Gameriker Oct 21 '21 at 08:24

1 Answers1

4
  1. The software you're trying to compile is 2-3 years old. It must have been written & tested with Qt 5 in mind.
  2. The Qt version you're using is 6.2 (this is seen in the error message).
  3. In Qt 5, class QTextStream has a member function setCodec, see https://doc.qt.io/qt-5/qtextstream-members.html
  4. In Qt 6 this member function is gone: https://doc.qt.io/qt-6/qtextstream-members.html

Conclusions:

The simplest solution would be for you to downgrade Qt version to the 5 series. Otherwise you risk being forced to resolve differences between code written for Qt 5 and your Qt 6 library. This may be easy - I don't know. Anyway, Qt 5 is still widely used, in particular, even your brand new QtCreator was compiled with it.

Some hints on porting Qt 5 applications to Qt 6: https://www.qt.io/blog/porting-from-qt-5-to-qt-6-using-qt5compat-library

According to the blog behind the link, QTextCodec has been replaced by QStringConverter, so there's no surprise that the setCodec member function was removed from QTextStream. Instead, I can see there a member function setEncoding, which seems to be the needed replacement. Go and try it yourself - I've never used this part of Qt.

zkoza
  • 2,644
  • 3
  • 16
  • 24