When I compile a large program for a mega 2560, although VS 2019 does not flag any errors, I get the following errors at the end of the compilation:
Severity Code Description Project File Line Suppression State
Error (.text.startup+0x96e): undefined reference to LogClass::BrokenLines <artificial>
Error (.text.startup+0x8f2): undefined reference to LogClass::ActiveLines <artificial>
Error (.text.startup+0x7f2): undefined reference to LogClass::State <artificial>
Error (.text.startup+0x970): undefined reference to LogClass::BrokenLines <artificial>
Error (.text.startup+0x7f0): undefined reference to LogClass::State <artificial>
Error (.text.startup+0x8f0): undefined reference to LogClass::ActiveLines <artificial>
Error error: ld returned 1 exit status collect2.exe
Warning In function main C:\Users\Abbott\AppData\Local\Temp\ccMkFEsR.ltrans0.ltrans.o
These public Log Class properties are used throughout the project.
// Log.h
#ifndef _LOG_h
#define _LOG_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
class LogClass
{
public:
static void Init();
static String ActiveLines;
static String BrokenLines;
static String FileName;
static String FlowLast;
static String FlowRate;
static String FlowTot;
static int FreeRam;
static String HeaterTempF;
static bool IsRunning;
static int JsonLenAct;
//todo Allocate 256b and allow value to be written
static String Message;
static String State;
static String TempF;
static String TimeDate;
static String VacuumPsi;
static String WebAction;
static String WebRequest;
};
extern LogClass Log;
#endif
I'm not sure how to approach finding my issue.
Thanks
Abbott
I've attached the verbose and the logger.cpp which uses the log.h