But I get an error. It seems that seperate.cpp is not seeing the functionInMain().
Both files are in the same directory and I'm using VSCode/Platformio.
How can I fix this? Do you have a solution for this?
your seperate.cpp doesn't have a declaration for functionMain().
void functionInMain();
the declaration tells the compiler what argument and argument types are required and the return type of the function.
the arduino IDE does some of this stuff for you if it is an .ino file
such declarations of functions, constants and possibly (not recomended) global variables are placed in a .h file that is included in other files that use those functions.