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

How to setup opcuaviewer example in QtCreator



  • Hi I'm trying to set up the opcuaviewer example in QtCreator in ubuntu 18.04.4 w Qt5.12 but I seem to have come across two issues:

    1. is that after compiling the opcua module in my local directory I have these:
    jchan@jchan-Z170N:~/Qt5.12.6/5.12.6/gcc_64/lib$ ls -la *OpcUa*
    -rw-r--r-- 1 jchan jchan      742 Feb  5 17:44 libQt5OpcUa.la
    -rw-r--r-- 1 jchan jchan     1213 Feb  5 17:44 libQt5OpcUa.prl
    lrwxrwxrwx 1 jchan jchan       21 Feb  5 17:44 libQt5OpcUa.so -> libQt5OpcUa.so.5.12.6
    lrwxrwxrwx 1 jchan jchan       21 Feb  5 17:44 libQt5OpcUa.so.5 -> libQt5OpcUa.so.5.12.6
    lrwxrwxrwx 1 jchan jchan       21 Feb  5 17:44 libQt5OpcUa.so.5.12 -> libQt5OpcUa.so.5.12.6
    -rwxr-xr-x 1 jchan jchan  1028576 Feb  5 17:43 libQt5OpcUa.so.5.12.6
    -rw-r--r-- 1 jchan jchan 13759248 Feb  5 17:43 libQt5OpcUa.so.5.12.6.debug
    

    but in qtcreator it seems to not be able to find my opcua module:
    unknown-module-opcua.png

    1. the examples that i've copied and pasted from here:
      https://doc.qt.io/QtOPCUA/qtopcua-opcuaviewer-example.html
      don't seem to have a ui_certificatedialog.h
      which is referenced in certificatedialog.cpp. Could I be missing some of the example files if so where would I get them or is this something that I should be implementing my self?

  • Lifetime Qt Champion

    @James-Mark-Chan Your LIBS in pro file does not contain actual lib. It should be:

    LIBS += -LPATH_TO_LIB_DIR -lQt5OpcUa
    

    ui_certificatedialog.h will be generated when compiling.



  • Thank you for this post. I just discovered that I should have been using the examples from the qt clone instead of manually copying the text from the web url and it seems no LIBS += ... line was even needed as my creator was configured to use the default kit. It is launching now. I do wonder why my objects under the device folder node are not showing and will be looking into it.
    opcuaviewer-example-cs208.png


Log in to reply