we are developing machine control systems with Qt 5.4.1 / MinGW for Win32 (using MinGW has historical background).
To use OPC UA we got the C++ OPC SDK with source. I could compile the SDK according the Build Instructions V1.2.2 under paragraph 6.4 "Create MinGW Makefiles projects" without any problems.
Next i modified our existing OpcClient class to meet the reqirements according to your SampleClient code from Lesson 1 "Connect and Read". Commented out everything not necessary, so finally our class is the same than in the example, up to step 3.
The OPC SDK is located in the subfolder ..\OpcUaClient\, parallel to all other modules of our Control System Project and other third party modules.
Qt is compiling everything but there is some linker Problem:
Code: Select all
g++ -Wl,-s -shared -Wl,-subsystem,windows -mthreads -Wl,--out-implib,release\libXOpcLaser.a -o release\XOpcLaser.dll object_script.XOpcLaser.Release -lglu32 -lopengl32 -lgdi32 -luser32 -L..\build-XComboBox-Desktop_Qt_5_4_1_MinGW_32bit-Release\release -L..\build-XToolButton-Desktop_Qt_5_4_1_MinGW_32bit-Release\release -L..\build-XLineEdit-Desktop_Qt_5_4_1_MinGW_32bit-Release\release -L..\_PLUGINS\XComboBox\release -L..\_PLUGINS\XToolButton\release -L..\_PLUGINS\XLineEdit\release -L..\OpcUaClient\lib -L..\OpenSSL\lib -lXLineEditDesignerPlugin -lXToolButtonDesignerPlugin -lXComboBoxDesignerPlugin -luastack.dll -luabasecpp -luapkicpp -luaclientcpp -lxmlparsercpp -lcrypto -lssl -LC:/SOFTWARE/Qt/Qt5.4.1/5.4/mingw491_32/lib -lQt5Widgets -lQt5Gui -lQt5Core
..\OpcUaClient\lib/libuabasecpp.a(statuscode.cpp.obj):statuscode.cpp:(.text$_ZN12UaStatusCode17getResponseHeaderEP20_OpcUa_RequestHeaderP21_OpcUa_ResponseHeader+0xe): undefined reference to `OpcUa_DateTime_UtcNow'
..\OpcUaClient\lib/libuabasecpp.a(statuscode.cpp.obj):statuscode.cpp:(.text$_ZNK12UaStatusCode8toStringEv+0xce): undefined reference to `OpcUa_StringA_snprintf'
Makefile.Release:116: recipe for target 'release\XOpcLaser.dll' failed
C:/SOFTWARE/Qt/Qt5.4.1/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: ..\OpcUaClient\lib/libuabasecpp.a(statuscode.cpp.obj): bad reloc address 0xce in section `.text$_ZNK12UaStatusCode8toStringEv'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [release\XOpcLaser.dll] Error 1
mingw32-make[1]: Leaving directory 'D:/X/SOURCE/build-XOpcLaser-Desktop_Qt_5_4_1_MinGW_32bit-Release'
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
Code: Select all
... Target definitions
# DEFINES
DEFINES += \
WIN32_LEAN_AND_MEAN
... our own source / header / forms and resource files
OBJECTS_DIR += tempbuild
MOC_DIR += tempbuild
unix {
Debug:DESTDIR += debug
Release:DESTDIR += release
}
UI_DIR += tempbuild
INCLUDEPATH += \
... some other includes \
../OpcUaClient/include/uastack \
../OpcUaClient/include/uabasecpp \
../OpcUaClient/include/uaclientcpp \
../OpcUaClient/include/uapkicpp \
../OpcUaClient/include/xmlparsercpp \
../OpenSSL/include
Debug : QMAKE_LIBDIR += \
... some other libdirs \
../OpcUaClient/lib \
../OpenSSL/lib
Release: QMAKE_LIBDIR += \
... some other libdirs
../OpcUaClient/lib \
../OpenSSL/lib
# LIBRARIES
LIBS += \
-l ... some other libs \
-luastack.dll \
-luabasecpp \
-luapkicpp \
-luaclientcpp \
-lxmlparsercpp \
-lcrypto \
-lssl
Best regards,
Herbert