hello;
can someone tell me:
in which file is the decision, whether the sketch has its own int main or not and therefore the int main from the main.cpp should been taken ?
which is the name of this file and where can I get the source code of this file ?
thanks
If your code contains the main() function, it will be used; if it doesn't contain the main function, the default will be used.
As you did not write a tutorial, your topic has been moved to a more suitable location on the forum.
If you have installed the Arduino IDE, the source code is somewhere on your PC.
whre exactly is the source code ? where is the looking after the own int main or the taking the one from the main.cpp ?
That would depend on your PC operating system, which you forgot to mention.
On my Win 10 setup, I can find it by starting at Program Files (x86)>Arduino.
Here it is:
int main(void)
{
init();
initVariant();
#if defined(USBCON)
USBDevice.attach();
#endif
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
return 0;
}
which is the name of the file ?
Do yourself a favor, and do a little exploration for yourself!
It will be a good learning experience.
I am looking for the part of the builder where it decides if it shall take this code of the main.cpp or the own int main.
please do me a favor and try to understand exactly what I am looking for before posting replies.
As @sterretje points out, there is no explicit decision.
If you have a main() in your code, that will be used.
If you don't, as usually ppl do not, the main() is supplied behind the curtain. It calls your setuo(), once, then calls your loop() over and over infinity style.
It first does a few things you might miss if you supply your own main function.
a7
Yes I know that. There must a a part of a program which looks up if there ist a own main() or not. This part of a programm (I guess it ist the builder) am I looking for. I want to see how this part of the builder ist coded.
The code for the entire Arduino package, including the "builder" is ON YOUR PC. Look for it, and learn something about Arduino in the process.
I don't want to get suggestions about what to learn but I ask if someone knows about this or not. If someone knows please let me know the filename and the coded lines about this question.
But you still haven't bothered to tell us what sort of PC or Arduino installation you have.
Has it occurred to you that this might be important information?
windows 10 arduino 1.8.13
It's automatic, it is build in to the behaviour of the IDE build mechanism.
a7
yes it is automatic, it is stored in some exe.file, but for this exe.file there must somewhere exist the source code, and I am looking for someone who knows where to find this source code in the web (and not for someone who wants to lead me to search and trial and error)
See
See
I used google to find these things. Have you tried that?
a7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.