Hi guys, I am using PlatformIO for programming an arduino. The problem is that I have a static void that should change the static variable but after compiling the code I faced with the error in the vscode saying:
c:/users/hossein/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\main.cpp.o:(.text.loop+0x0): undefined reference to sampleClass::buffer'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\huzzah\firmware.elf] Error 1
I have also included my code in the following box. I would appreciate if anyone can give me a hint such that I can get my script to work.
#include <Arduino.h>
class sampleClass
{
public:
//variables
static int buffer[10];
static float ratio;
int64_t data;
// functions
static void filling()
{
sampleClass::buffer[1] = sampleClass::buffer[1] + 1;
printf(" the value of the buffer in the scope of the function is : %f \n", double(buffer[1]));
};
private:
};
sampleClass a;
void setup()
{
// put your setup code here, to run once:
}
void loop()
{
// put your main code here, to run repeatedly:
a.sampleClass::filling();
}