In the header I declared
#ifndef SOUND_CORE
#define SOUND_CORE
static SoundEngine soundEngine;
...
but the constructor for SoundEngine gets called multiple times, how is it possible, when it’s declared as global static
I call it as
#include "SoundCore.h"
and use it directly
soundEngine.foo()
thank you
I would use
externinstead of static. That’s whatexternis for.In the header:
In an accompanying source file:
This will create one translation unit with the instance, and including the header will allow you to use it everywhere in your code.