External class forward declaration

16 views
Skip to first unread message

Mathew Benson

unread,
Nov 27, 2022, 7:08:31 PM11/27/22
to YAKINDU User
I have the following in my state machine definition file:

interface:
    var App:  pointer<VM>

The documentation states that I need to add 'import: "vm_app.h"' to the definition file for it to generate the correct C++ code.  This doesn't quite work because my VM object also needs a handle to the state machine itself which results in a circular inclusion.  I use the single inclusion pattern (#ifndef FILE_H...) so one of them always fails.  The correct pattern would be a forward declaration in the header file, and the header inclusion in the implementation file.  For now, I have to manually add the forward class declaration to the generated header file and manually add the '#include "vm_app.h"' line to the generated .cpp file. 

Is there a better way to do this? 

Reply all
Reply to author
Forward
0 new messages