So I have a Class called Interpreter.
I have in it a struct call Commands and it contains functions.
I wanted to have a way to have a value that represent each function so after some research I used unorder map. VS code doesn't throw any error but when I compile it give me:C:\Users\ssoit\AppData\Local\Temp\ccHMlSVm.o:interpreter.cpp:(.text+0x65b): undefined reference to `Interpreter::commandFunctions' C:\Users\ssoit\AppData\Local\Temp\ccHMlSVm.o:interpreter.cpp:(.text+0x66b): undefined reference to `Interpreter::commandFunctions'
#Map of commands
14 messages · Page 1 of 1 (latest)
you declared your static variable but you didn't define it
either make it inline or define it in the .cpp file
the second screenshot the cpp file so shouldn't it be defined in line 114?
right
didn't see that
but it should be Interpreter::commandFunctions
otherwise you're declaring a new variable which is global
instead of the one inside the scope of the class
Wow, my skills are so high XD, thanks, It work now! last thing: the commands struct functions (like in screenshot the add and set) needs to have some data about its parent, so how could it access it?
@manic sonnet has reached level 1. GG!
I have a class by the same name. Its a class that interprets keywords to be used for a custom language. What does this interpreter do exactly?
it reads a binary array(which is a copy of a binary file) and reads instruction from it. Like 0000 01 0008 sets the value 8 into register B. For the question, it interprets a asm-like language which I develop how it should be written in binary at school. (it is very not advance rn)
@manic sonnet has reached level 2. GG!