Hello, I just took over a project and started to learn QP/QM. Because this project use QM to develop some applications and then generate code by QM, these created C++ file will be merged and combined in our Keil uvsion platform to run compiling and create firmware to download into our device. Recently, I upgraded our QP/QM from QM 4.0.3 ( QP 5.9.1) in QM 5.1.1 (QP 6.9.0). But, after Generate Code, Keil compiler show the error for Q_SUPER, (see attached picture). Our codes like below, in QM 4.0.3, no any error when compile.
default: {
status_ = Q_SUPER(&APP_Messaging);
break;
}
I researched and find maybe the latest version should use status_ = super (&APP_Messaging); instead of.
As a beginner, so far, I do not know how to modify this Q_SUPER(). Because I cannot find where this function in QM, looks the QM automaticly generate it, not wrote by us. And in Keil side, all of QP/QM program are locked, cannot change there ( see a key icon on file name in attached picture).
Are there some ways I can fix this issue. Thanks a lot!
This macro is part of the "QP/C++ API compatibility layer" in qpcpp.hpp header file in the qpcpp\include directory. I will file a bug report for this and the bug fix will be included in the next, upcoming QP/C++ version 7.0.0 release.
While the change above will allow you to compile the generated code by QM, the larger issue here is that you are using the older state machine implementation in C++ based on the me pointer.
If you are already going through the trouble to upgrade to the newer version of QP/C++, I would highly recommend that you start using the newer "no me-pointer" implementation. This new implementation is much more natural in C++, because state handlers are the regular members of the state machine class, so you use the implicit this pointer instead of the me-> pointer.
To convert your existing implementation, you simply need to uncheck the "Use me->" checkbox in QM (in the Statechart property sheet, see also the attached screen shot). After this, you need to remove all "me->" strings from your model and also replace all references to "me" with "this". I hope that this makes sense to you.
Hello, I just took over a project and started to learn QP/QM. Because this project use QM to develop some applications and then generate code by QM, these created C++ file will be merged and combined in our Keil uvsion platform to run compiling and create firmware to download into our device. Recently, I upgraded our QP/QM from QM 4.0.3 ( QP 5.9.1) in QM 5.1.1 (QP 6.9.0). But, after Generate Code, Keil compiler show the error for Q_SUPER, (see attached picture). Our codes like below, in QM 4.0.3, no any error when compile.
default: {
status_ = Q_SUPER(&APP_Messaging);
break;
}
I researched and find maybe the latest version should use status_ = super (&APP_Messaging); instead of.
As a beginner, so far, I do not know how to modify this Q_SUPER(). Because I cannot find where this function in QM, looks the QM automaticly generate it, not wrote by us. And in Keil side, all of QP/QM program are locked, cannot change there ( see a key icon on file name in attached picture).
Are there some ways I can fix this issue. Thanks a lot!
Hi June,
You have found a backwards-compatibility issue. The current version of the
Q_SUPER()
macro is incomplete and needs to be updated as follows:This macro is part of the "QP/C++ API compatibility layer" in
qpcpp.hpp
header file in theqpcpp\include
directory. I will file a bug report for this and the bug fix will be included in the next, upcoming QP/C++ version 7.0.0 release.While the change above will allow you to compile the generated code by QM, the larger issue here is that you are using the older state machine implementation in C++ based on the
me
pointer.If you are already going through the trouble to upgrade to the newer version of QP/C++, I would highly recommend that you start using the newer "no me-pointer" implementation. This new implementation is much more natural in C++, because state handlers are the regular members of the state machine class, so you use the implicit
this
pointer instead of theme->
pointer.To convert your existing implementation, you simply need to uncheck the "Use me->" checkbox in QM (in the Statechart property sheet, see also the attached screen shot). After this, you need to remove all "me->" strings from your model and also replace all references to "me" with "this". I hope that this makes sense to you.
--MMS
Last edit: Quantum Leaps 2022-01-24
Bug report has been filed:
https://sourceforge.net/p/qpc/bugs/301/
--MMS
Thank you so much! big help to me.
I will read documents and try the way.