The error message is correct, you have not defined main() – just setup() and loop(), which is Arduino specific and thus don’t get called in the test environment for a desktop.
Per official example you should do it in the style
If you want to use the same test file for both embedded + desktop tests, see here.
I will strongly disagree. The error messages does not suggest anything, unless you already know what’s going on, because you’ve stumbled upon that before.
pio run -e test
Processing test (platform: native)
--------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoFake @ 0.3.1
Building in release mode
Linking .pio/build/test/program
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** [.pio/build/test/program] Error 1
That’s the error that I didn’t understand, until I came upon this thread from googling platformio implicit entry/start for main executable.
Undefined symbols suggests to me that I have used some kind of symbols (like $ or <).
for architecture x86_64 misleads me into thinking about CPU architectures, does having x86_64 really make a difference in this situation?
"_main" – I grep for this and find nothing.
referenced from: implicit entry/start for main executable – how can I go there and look for the problem? which file, which line is it?
The message could be like:
Error: you must define int main(int argc, char **argv) function, required to execute the program.
Or ike this [let’s reuse the wording that was poorly chosen in a better context]:
Error: Required implicit entry/start for main executable: missing int main(int argc, char **argv) function.