I would like to use a static std::queue
(static std::queue<Efeito*> efeitos;
) to be called in my static functions in the same class, but I tried several ways and the one thing I got is a error:
undefined reference to EfeitosVisuais::efeitos'
Here is the code:
#include <iostream>
#include <queue>
#include "Efeito.h"
#include "Efeitos Visuais/EfeitoPedregulho.h"
class EfeitosVisuais {
public:
static std::queue<Efeito*> efeitos;
static void AddEfeito(double x, double y,char efeito){
switch(efeito){
case 'P':
EfeitoPedregulho *pedregulho = new EfeitoPedregulho(x,y);
efeitos.push(pedregulho);
break;
}
}
static void Atualizar(int tempodejogo) {
if(!efeitos.empty()) {
for (int i = 0; i < efeitos.size(); i++) {
efeitos.front()->Atualiza(tempodejogo);
efeitos.push(efeitos.front());
efeitos.pop();
}
}
}
};
How to solve it?