C++ best practice

Hello!
I’m new to GDevelop, and to game development in general. I’m currently trying to understand the best way to use C++ in this engine.

What is the best way to separate the code I want to execute only once (like variables declaration) from the actual logic of the game?
Should I include a file and do my main loop there? Or there is a way to insert a C++ Code item in the Events tab that only executes once?

Thanks

I could have sworn there was an article about c++ code events in the wiki but I can’t find it.
Using c++ code events is similar to the javascript event explained here:
http://compilgames.net/wiki/doku.php/gdevelop/tutorials/usingjsevents

To insert a c++ event in your desktop project click on the “other” button under create event and choose “c++ code”.
You can set the c++ code event as a subevent of some condition in order to make it trigger only one / under certain conditions.
If you want to include a whole c++ file you need to check “Activate the use of c++ / js code files” in the properties of your project.