ARTICLE AD BOX
The linker tells me that arrSize is undefined even though its defined in tasks.cpp at the 2nd line, the 1st one is the include, the namespace, type, everything is correct, but it still gives me an error
Header snippet:
class Task { private: uint64_t sp; uint64_t pc; int32_t args[31]; int32_t regs[31]; static void growTaskArr(); static void initTasks(); static unsigned int arrSize; public: Task(function_t func = (function_t)blankFunc, int32_t _args[] = nullArgs); void exec(); static void interrupt(Task& taskToPrioritize, int priorityLevel = 2); static unsigned int getArrSize(); static void shrinkTaskArr(); static void hardwareInterrupt(Task& task); bool operator!= (const Task& other) const; };cpp snippet:
__attribute__((used)) unsigned int Task::arrSize = 32;Linker error:
arm-none-eabi-ld: CENSORED/tasks.o: in function `Task::getArrSize()': tasks.cpp:(.text+0x1b0): undefined reference to `Task::arrSize' arm-none-eabi-ld: tasks.cpp:(.text+0x1b4): undefined reference to `Task::arrSize' arm-none-eabi-ld: CENSORED/tasks.o: in function `Task::growTaskArr()': tasks.cpp:(.text+0x1c0): undefined reference to `Task::arrSize' arm-none-eabi-ld: tasks.cpp:(.text+0x1c4): undefined reference to `Task::arrSize' arm-none-eabi-ld: CENSORED/tasks.o: in function `Task::Task(void (*)(int), int*)': tasks.cpp:(.text+0x2a0): undefined reference to `Task::arrSize' arm-none-eabi-ld: CENSORED/tasks.o:tasks.cpp:(.text+0x2a4): more undefined references to `Task::arrSize' follow arm-none-eabi-ld: CENSORED/tasks.o: in function `Task::Task(void (*)(int), int*)': tasks.cpp:(.text+0x310): undefined reference to `void derivatedArray<Task>(Task*, Task*)' arm-none-eabi-ld: CENSORED/tasks.o: in function `Task::initTasks()': tasks.cpp:(.text+0x3f4): undefined reference to `Task::arrSize' arm-none-eabi-ld: tasks.cpp:(.text+0x3f8): undefined reference to `Task::arrSize' Pressione qualquer tecla para continuar...