How to use REPC ?
-
Hello everybody
I just intalled Qt 5.12 and want to use the QtRO mechanism.
I read the doc / sample that are online but I don't find any information on how the REPC should be used from within QtCreaor.
I have compiled the qtremoteobects module but I don't know how to get further.
What I have tried so far is to declare an external tool that launches repc like this:
Executable:D:\Qt\Qt5.12.0\5.12.0\Src\build-qtremoteobjects-Desktop_Qt_5_12_0_MinGW_64_bit-Release\bin\repc.exe
Arguments:
-i"%{CurrentDocument:FilePath}" -o"%{CurrentDocument:Path}/rep_%{CurrentDocument:FileBaseName}.h"
Running the external tool then with the current file being my .rep file with the following content:
class SimpleSwitch { PROP(bool currState=false); SLOT(server_slot(bool clientState)); };
I don't get any errors but the rep_xxx.h file is not being created
Any help very much appreciated!
many thanks in advance,
Wink -
Hi and welcome to the forums.
Please give a little more detail of what you are trying to do.
REPC could mean anything. -
@wink
Yes much better :)
I did not try this module myself , however
https://doc.qt.io/qt-5.11/qtremoteobjects-repc.html
indicates you can use
REPC_SOURCE and REPC_REPLICA
in the project file to flag files to run the tool on.
I assume it has same syntax like SOURCES / INCLUDES
but doc is not clear about that. -
Yes I have the following lines in my .pro file:
REPC_SOURCE = MyRemoteObject.rep QT += remoteobjects QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses 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 SOURCES += \ main.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES += \ MyRemoteObject.rep
But I don't know how QtCreator knows how to use the repc.exe that I have built.
When invoking it like I explaned before nothing happens.
running qmake does nothing repc specific either. -
@wink
Hi
for my Qt5.12 installation, it comes with repc.exe in
So i think compiling it yourself was back when it was Tech Preview.
Could you check if you have tool there too ?
Thats how creator knows where to find it however
if you have repc.exe there too , it dont explain why no files are generated. -
@mrjj Hi and thanks for your reply!
I have indeed the repc.exe in my D:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin folder (I didn't install the MSVC version though).So if Qt creator knows where repc is, what is it that triggers its launch? is it qmake?
I tried again to run qmake but it does not seem to call repc.Any ideas?
best regards
Wink -
@mrjj Hi
here is the output of the compiler window:
11:06:49: Running steps for project RemoteObjectServer... 11:06:49: Starting: "D:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\qmake.exe" D:\dev\RemoteObjectServer\RemoteObjectServer.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" 11:06:50: The process "D:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\qmake.exe" exited normally. 11:06:50: Starting: "D:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" -f D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 11:06:50: The process "D:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited normally. 11:06:50: Elapsed time: 00:01.
and here is the rep file content:
class SimpleSwitch { PROP(bool currState=false); SLOT(server_slot(bool clientState)); };
And this is the output when building the project:
11:10:20: Running steps for project RemoteObjectServer... 11:10:20: Starting: "D:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" clean -j8 D:/Qt/Qt5.12.0/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug clean D:/Qt/Qt5.12.0/Tools/mingw730_64/bin/mingw32-make -f Makefile.Release clean mingw32-make[1]: Entering directory 'D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' del debug\qrc_qml.cpp mingw32-make[1]: Entering directory 'D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' del release\qrc_qml.cpp del debug\moc_predefs.h del release\moc_predefs.h del rep_MyRemoteObject_source.h del rep_MyRemoteObject_source.h del release\moc_rep_MyRemoteObject_source.cpp del debug\moc_rep_MyRemoteObject_source.cpp Impossible de trouver D:\dev\build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug\release\qrc_qml.cpp Impossible de trouver D:\dev\build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug\release\moc_predefs.h Impossible de trouver D:\dev\build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug\debug\moc_predefs.h Impossible de trouver D:\dev\build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug\rep_MyRemoteObject_source.h Impossible de trouver D:\dev\build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug\release\moc_rep_MyRemoteObject_source.cpp del release\main.o release\qrc_qml.o release\moc_rep_MyRemoteObject_source.o del debug\main.o debug\qrc_qml.o debug\moc_rep_MyRemoteObject_source.o Impossible de trouver D:\dev\build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug\release\main.o mingw32-make[1]: Leaving directory 'D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' mingw32-make[1]: Leaving directory 'D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' 11:10:21: The process "D:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited normally. 11:10:21: Configuration unchanged, skipping qmake step. 11:10:21: Starting: "D:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" -j8 D:/Qt/Qt5.12.0/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_REMOTEOBJECTS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\RemoteObjectServer -I. -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtQuick -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtGui -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtANGLE -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtQml -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtRemoteObjects -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtNetwork -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtCore -Idebug -I..\RemoteObjectServer -I\include -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\mkspecs\win32-g++ -o debug\main.o ..\RemoteObjectServer\main.cpp D:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\rcc.exe -name qml ..\RemoteObjectServer\qml.qrc -o debug\qrc_qml.cpp D:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\repc.exe -o source -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtRemoteObjects -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtRemoteObjects ..\RemoteObjectServer\MyRemoteObject.rep rep_MyRemoteObject_source.h g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_REMOTEOBJECTS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\RemoteObjectServer -I. -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtQuick -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtGui -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtANGLE -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtQml -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtRemoteObjects -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtNetwork -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtCore -Idebug -I..\RemoteObjectServer -I\include -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\mkspecs\win32-g++ -o debug\qrc_qml.o debug\qrc_qml.cpp D:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_REMOTEOBJECTS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug/debug/moc_predefs.h -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/mkspecs/win32-g++ -ID:/dev/RemoteObjectServer -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtQuick -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtGui -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtANGLE -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtQml -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtRemoteObjects -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtNetwork -ID:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtCore -I. -ID:/Qt/Qt5.12.0/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++ -ID:/Qt/Qt5.12.0/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/x86_64-w64-mingw32 -ID:/Qt/Qt5.12.0/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/backward -ID:/Qt/Qt5.12.0/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include -ID:/Qt/Qt5.12.0/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include-fixed -ID:/Qt/Qt5.12.0/Tools/mingw730_64/x86_64-w64-mingw32/include rep_MyRemoteObject_source.h -o debug\moc_rep_MyRemoteObject_source.cpp -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtRemoteObjects -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include -I D:/Qt/Qt5.12.0/5.12.0/mingw73_64/include/QtRemoteObjects Warning: Failed to resolve include "D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug/debug/moc_predefs.h" for moc file rep_MyRemoteObject_source.h g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_REMOTEOBJECTS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\RemoteObjectServer -I. -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtQuick -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtGui -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtANGLE -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtQml -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtRemoteObjects -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtNetwork -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\include\QtCore -Idebug -I..\RemoteObjectServer -I\include -I..\..\Qt\Qt5.12.0\5.12.0\mingw73_64\mkspecs\win32-g++ -o debug\moc_rep_MyRemoteObject_source.o debug\moc_rep_MyRemoteObject_source.cpp g++ -Wl,-subsystem,windows -mthreads -o debug\RemoteObjectServer.exe debug/main.o debug/qrc_qml.o debug/moc_rep_MyRemoteObject_source.o -LD:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5Quickd.a D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5Guid.a D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5Qmld.a D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5RemoteObjectsd.a D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5Networkd.a D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5Cored.a -lmingw32 D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libqtmaind.a -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-winx64\lib -LC:\Utils\postgresql\pgsql\lib -lshell32 -LD:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib D:\Qt\Qt5.12.0\5.12.0\mingw73_64\lib\libQt5Cored.a mingw32-make[1]: Leaving directory 'D:/dev/build-RemoteObjectServer-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' 11:10:23: The process "D:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited normally. 11:10:23: Elapsed time: 00:03.
-
@wink Hello just to inform you about the current state, I removed all my Qt versions and did a clean install. Now I'm getting the rep_xxx_source.h file generated inside the build directory. I'll proceed from here and I'll let you know how it goes...
best regards
Wink