I have a function “void foo()” and inside foo I call the function “void bar()”
but I keep getting the error “In function ‘void foo()’ error: function ‘bar’ was not declared in this scope”.
I have done some research and can’t seem to find anything that helps.
Does anyone know the issue? I’m sure it’s probably simple but can’t find the answer.
You haven’t declared the function before you use it.
Try something like:
Alternatively, if
bar()is declared in a different header, you can include that header instead. Or you could definebar()beforefoo()(unless of course bar() uses foo()).