I ahve a problem with a code below:
ProgrammSettings.h
#pragma once
static class ProgrammSettings
{
public:
static int fd;
};
Settings.cpp
#include "ProgrammSettings.h"
static bool LoadSettings()
{
ProgrammSettings::fd = 2; // here error Unresolved symbol!!
return true;
}
What i’m doing wrong?
Thanks!
Unlike instance variables that require only a declaration, static member variabs of the class must also be defined.
Currently, your code contains only a declaration. Add a definition of your static
fdvariable to a cpp file to fix the error: