Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Unknown module(s) in QT: opcua



  • I tried this document with reference, but I got such an error.
    Can you help me ?

    https://doc.qt.io/QtOPCUA/index.html

    Project ERROR: Unknown module(s) in QT: opcua
    Project ERROR: Unknown module(s) in QT: opcua

    Mainwindow.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QtOpcUa>
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    

    pro file

    QT       += core gui opcua
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++11
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    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
    
    

  • Lifetime Qt Champion

    Hi
    I dont think they included it in the installer yet.
    I used
    https://blog.basyskom.com/building-qt-opc-ua-with-open62541/
    with Qt 5.12 on Linux to try it out.



  • This post is deleted!


  • cd src/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_32/bin/qmake.exe -o Makefile C:/Qt/5.14.2/mingw73_32/qtopcua/src/src.pro ) && mingw32-make -f Makefile install
    mingw32-make[1]: Entering directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src'
    cd opcua/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_32/bin/qmake.exe -o Makefile C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/opcua.pro ) && C:/Qt/Tools/mingw730_32/bin/mingw32-make -f Makefile install
    mingw32-make[2]: Entering directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    C:/Qt/Tools/mingw730_32/bin/mingw32-make -f Makefile.Release install
    mingw32-make[3]: Entering directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    cp -f ../../lib/Qt5OpcUa.dll C:/Qt/5.14.2/mingw73_32/bin/Qt5OpcUa.dll
    C:/Qt/5.14.2/mingw73_32/bin/qmake.exe -install qinstall C:/Qt/5.14.2/mingw73_32/qtopcua/build/lib/Qt5OpcUa.dll.debug C:/Qt/5.14.2/mingw73_32/lib/Qt5OpcUa.dll.debug
    sed  -e 's,C:/Qt/5.14.2/mingw73_32/qtopcua/build/lib,$$[QT_INSTALL_LIBS],g' -e 's,C:/Qt/5.14.2/mingw73_32/lib,$$[QT_INSTALL_LIBS],g' ../../lib/Qt5OpcUa.prl > C:/Qt/5.14.2/mingw73_32/lib/Qt5OpcUa.prl
    sed  -e s,C:/Qt/5.14.2/mingw73_32/qtopcua/build/lib,C:/Qt/5.14.2/mingw73_32/lib,g ../../build/lib/pkgconfig/Qt5OpcUa.pc > C:/Qt/5.14.2/mingw73_32/lib/pkgconfig/Qt5OpcUa.pc
    sed: can't read ../../build/lib/pkgconfig/Qt5OpcUa.pc: No such file or directory
    mingw32-make[3]: *** [Makefile.Release:2973: install_target] Error 2
    mingw32-make[3]: Leaving directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    mingw32-make[2]: *** [Makefile:55: release-install] Error 2
    mingw32-make[2]: Leaving directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    mingw32-make[1]: *** [Makefile:64: sub-opcua-install_subtargets] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src'
    mingw32-make: *** [Makefile:65: sub-src-install_subtargets] Error 2
    

    i get this error



  • and i got this error mingw32-make

    C:\Qt\5.14.2\mingw73_32\qtopcua\build>mingw32-make
    cd src/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_32/bin/qmake.exe -o Makefile C:/Qt/5.14.2/mingw73_32/qtopcua/src/src.pro ) && mingw32-make -f Makefile
    mingw32-make[1]: Entering directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src'
    cd opcua/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_32/bin/qmake.exe -o Makefile C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/opcua.pro ) && C:/Qt/Tools/mingw730_32/bin/mingw32-make -f Makefile
    mingw32-make[2]: Entering directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    C:/Qt/Tools/mingw730_32/bin/mingw32-make -f Makefile.Release
    mingw32-make[3]: Entering directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    g++ -c -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O2 -g -std=c++1z -fno-exceptions -Wall -Wextra -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_LINKED_LIST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_OPCUA_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_NO_FOREACH -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -IC:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua -I. -I../../include -I../../include/QtOpcUa -I../../include/QtOpcUa/6.1.0 -I../../include/QtOpcUa/6.1.0/QtOpcUa -Itmp -IC:/Qt/5.14.2/mingw73_32/include/QtNetwork/5.14.2 -IC:/Qt/5.14.2/mingw73_32/include/QtNetwork/5.14.2/QtNetwork -IC:/Qt/5.14.2/mingw73_32/include/QtCore/5.14.2 -IC:/Qt/5.14.2/mingw73_32/include/QtCore/5.14.2/QtCore -IC:/Qt/5.14.2/mingw73_32/include -IC:/Qt/5.14.2/mingw73_32/include/QtNetwork -IC:/Qt/5.14.2/mingw73_32/include/QtCore -I.moc/release -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-win32\include -IC:\Utils\postgresql\pgsql\include -IC:/Qt/5.14.2/mingw73_32/mkspecs/win32-g++  -o .obj/release/qopcuatype.o C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp
    C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp: In function 'QString QOpcUa::nodeIdFromGuid(quint16, const QUuid&)':
    C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp:635:99: error: no matching function for call to 'QString::append(QStringView)'
         return QStringLiteral("ns=%1;g=").arg(ns).append(QStringView(identifier.toString()).mid(1, 36)); // Remove enclosing {...};
                                                                                                       ^
    In file included from C:/Qt/5.14.2/mingw73_32/include/QtCore/qhashfunctions.h:44:0,
                     from C:/Qt/5.14.2/mingw73_32/include/QtCore/qvarlengtharray.h:47,
                     from C:/Qt/5.14.2/mingw73_32/include/QtCore/qmetatype.h:48,
                     from ../../include/QtOpcUa/../../../src/opcua/client/qopcuanodeids.h:42,
                     from ../../include/QtOpcUa/qopcuanodeids.h:1,
                     from C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.h:41,
                     from C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp:37:
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:534:14: note: candidate: QString& QString::append(QChar)
         QString &append(QChar c);
                  ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:534:14: note:   no known conversion for argument 1 from 'QStringView' to 'QChar'
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:535:14: note: candidate: QString& QString::append(const QChar*, int)
         QString &append(const QChar *uc, int len);
                  ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:535:14: note:   candidate expects 2 arguments, 1 provided
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:536:14: note: candidate: QString& QString::append(const QString&)
         QString &append(const QString &s);
                  ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:536:14: note:   no known conversion for argument 1 from 'QStringView' to 'const QString&'
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:537:14: note: candidate: QString& QString::append(const QStringRef&)
         QString &append(const QStringRef &s);
                  ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:537:14: note:   no known conversion for argument 1 from 'QStringView' to 'const QStringRef&'
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:538:14: note: candidate: QString& QString::append(QLatin1String)
         QString &append(QLatin1String s);
                  ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:538:14: note:   no known conversion for argument 1 from 'QStringView' to 'QLatin1String'
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:812:40: note: candidate: QString& QString::append(const char*)
         inline QT_ASCII_CAST_WARN QString &append(const char *s)
                                            ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:812:40: note:   no known conversion for argument 1 from 'QStringView' to 'const char*'
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:814:40: note: candidate: QString& QString::append(const QByteArray&)
         inline QT_ASCII_CAST_WARN QString &append(const QByteArray &s)
                                            ^~~~~~
    C:/Qt/5.14.2/mingw73_32/include/QtCore/qstring.h:814:40: note:   no known conversion for argument 1 from 'QStringView' to 'const QByteArray&'
    C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp: In function 'bool QOpcUa::nodeIdStringSplit(const QString&, quint16*, QString*, char*)':
    C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp:677:56: error: 'class QStringView' has no member named 'toUInt'; did you mean 'toUtf8'?
             uint ns = QStringView(components.at(0)).mid(3).toUInt(&success);
                                                            ^~~~~~
                                                            toUtf8
    C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp: In function 'QOpcUa::NodeIds::Namespace0 QOpcUa::namespace0IdFromNodeId(const QString&)':
    C:/Qt/5.14.2/mingw73_32/qtopcua/src/opcua/client/qopcuatype.cpp:744:29: error: 'const class QStringView' has no member named 'toUInt'; did you mean 'toUtf8'?
         quint32 identifier = sv.toUInt(&ok);
                                 ^~~~~~
                                 toUtf8
    mingw32-make[3]: *** [Makefile.Release:5746: .obj/release/qopcuatype.o] Error 1
    mingw32-make[3]: Leaving directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    mingw32-make[2]: *** [Makefile:45: release] Error 2
    mingw32-make[2]: Leaving directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src/opcua'
    mingw32-make[1]: *** [Makefile:52: sub-opcua-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qt/5.14.2/mingw73_32/qtopcua/build/src'
    mingw32-make: *** [Makefile:53: sub-src-make_first] Error 2
    

Log in to reply