Closed ats3788 closed 2 years ago
It does not work in my case with the Arduino syntax setup() & loop() you have to change it to main() function.
I have this exact issue, what is the solution @ats3788
Thanks
When compiling for platform = native
you need to define the main()
function to generate a proper executable. The entry point of a normal PC program is not setup()
. See official example for a way to automatically create the correct entry point.
The examples here in this repository all have setup() and loop() and NO main(), so are these examples wrong?
Huh?
Both of the examples here have the main function. It's intended for testing (pio test
, sources in test/
), not compilation of the src/
program on the native platform. If you want that, you need a main()
.
So that's alright.
You're pointing at a source in src/
. This library is intended for testing, the sources in test/
matter. src/
is supposed to be your embedded firmare, hence "real arduino" with setup()
and loop
, test/
the tests for your native machine, hence, main()
.
Thanks for the clarification @maxgerhardt
@prof7bit , @ats3788 let me know if it still not clear..
Where has the main.cpp File to be I put it in the src folder.