mam problem przy tej klasie:
#pragma once
#include <GLFW/glfw3.h>
class Timer {
public:
Timer();
~Timer();
void Tick();
double GetElapsedSeconds();
private:
static double previousSeconds;
double currentSeconds;
double elapsedSeconds;
};
#include "Timer.h"
Timer::Timer() {
previousSeconds = 0;
currentSeconds = 0;
elapsedSeconds = 0;
}
Timer::~Timer() {
}
void Timer::Tick() {
previousSeconds = glfwGetTime();
currentSeconds = glfwGetTime();
elapsedSeconds = currentSeconds - previousSeconds;
previousSeconds = currentSeconds;
}
double Timer::GetElapsedSeconds() {
return elapsedSeconds;
}
Gdy kompiluje program wyskakuje mi błąd
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "public: static double Timer::previousSeconds" (?previousSeconds@Timer@@2NA) Renderer D:\Projekty\OpenGL_Renderer\Renderer\Renderer\Timer.obj 1
problem nie występuje gdy usunę przy zmiennej *previousSeconds *słowo static
W pozostałej części programu jest tylko tworzony obiekt klasy, więc chyba nie ma sensu dodania tego, by tylko zaciemniło.
Nie wiem co jeszcze może się przydać, żeby spróbować rozwiązać ten problem.