Functions used before definition


#1

Hi all! I am having a lot of issues with undefined variables while trying to load ulisp onto my esp32-c3. They all appear to be functions used before being defined - the first one my compiler runs into is pserial but there are a bunch of others after. . I come from the Python world (mostly) but in my experience with C and C++ you have to either define functions earlier in the file than you use them or declare them in a header file, right? Do you know what I am missing? Thanks!


#2

If you’re using the Arduino IDE you generally don’t have to define forward references, because the IDE takes care of it. I assume you’re using a different IDE?

The forward references are defined in the block:

// Forward references
object *tee;
void pfstring (PGM_P s, pfun_t pfun);

Just add the ones you need there; for example:

void pserial (char c);

#3

Ohh that is my issue exactly - I’m using CLion and platformio. I will make that change - thank you!!