@Manu, great you gave VisualTeensy a try.
Quick answer:
If you want to get the same behaviour as you get with the Arduino IDE
you can set the underlying build system to "Arduino Builder" with a switch in the settings tab. It then uses the same build system as used by the Arduino IDE instead of the standard c++ system. See here for a documentation:
https://github.com/luni64/VisualTeensy/wiki. There are small chapters about how to use the Arduino Builder, and how to open an Arduino "ino project".
Long answers:
I had to declare all the functions used in the project at the beginning of main.cpp, like I use to do in C. Is this normal ? I know it is the way to go with C, but I don't really know C++ and arduino IDE don't need such things.
Yes, this is normal. C and c++ need to know the declaration of everything before they can use it. Usually forward declaration is not a big deal if you organize your project in *.cpp and *.h files. The header files (*.h) simply contain the required forward declarations of the stuff in the *.cpp files and you would #include them whenever needed.
For some reason the Arduino design team decided to hide this from their users and did something like a "pre-preprocessor". AFAIK it collects files it finds in the sketch folder and combines them into one huge file. It then auto generates all required forward declarations at the top of this file and compiles it. This works nicely for the small sketches 99% of the users usually do. IMHO this is one of the reasons for the huge success of the Arduino ecosystem. However, to me this always felt like those support wheels you give children to learn to ride a bicycle. Great for learning but once you know how to ride you want to get rid of them. But, all of this is my personal opinion only and instead of complaining I tend to fix stuff for me and so I did VisualTeensy...
I selected 'TeensytimerTool' in VT, but it doesn't appear in VCS under LIB tab. And at compilation I got and error that say "can't find "teensyTimerTool.h". How can I solve this please ? The funny thing is that it compile, upload, and operate.
Looks like the VT Wiki needs some explanation of the library system
Basically you can choose libraries from the following 3 repositories:
- 'Teensyduino Libraries' which contains all Teensyduino libraries you installed when you installed Teensyduino.
- 'Arduino Repository' which contains all libraries the Arduino library manager knows of. This is a huge repository and usually contains everything you need. Use the search field below the list of libraries to wade through it.
- 'Installed shared libraries' which contains all libraries you installed manually or via the Arduino library manager. Usually they live in the library subfolder of the arduino sketchbook.
Libraries from the first two repositories are copied to your project folder. This means you can have different versions for different projects which is usually good since it prevents new library versions breaking existing code. Libraries from the shared folder are not copied to the project. The project will use them directly from the shared folder. (Something like "copy it to the project folder anyway" for shared libraries might be a good enhancement though.)
Back to your question: I assume that you installed the TeensyTimerTool via the Arduino library manager so it ends up in the shared library folder and won't be copied to the project but used from the shared folder. So, all good.
I got and error that say "can't find "teensyTimerTool.h"... The funny thing is that it compile, upload, and operate
This obviously is an intellisense error only (otherwise it wouldn't compile). Intellisense gets information about where to look for headers from the file .vscode/c_cpp_properties.json. Sometimes (seldom) vsCode doesn't get noticed about changes in this file (maybe some cache thing). Usually, closing vsCode and reopening it fixes this.
From KurtE: TyCommander is part of:
https://github.com/Koromix/tytools
Teensyloader stuff can usually be found at:
https://www.pjrc.com/teensy/loader_cli.html
I recommend to use the TyCommander for its nice GUI and most important: it includes a serial monitor. It also perfectly supports projects with more than one Teensy which makes server/client developments MUCH easier. The Teensyloader CLI is used by some for advanced scenarios. You probably don't need it.
From KurtE: As you may notice there are lots of ways/IDEs you can go to, including the great work of @luni
Then there is VisualMicro stuff, which I use some of the time -
https://www.visualmicro.com/
I also started with VisualMicro which is great stuff indeed. But, IMHO, using the VisualStudio IDE for Arduino builds has one big disadvantage: the underlying intellisense engine uses the microsoft compiler which of course is not compatible to the GCC used for Teensy. I.e., the compiler used for building the project is not the same as that used for intellisense. VisualMicro is working around that by generating a header which hides most of the differences by undefining gcc stuff, but of course this can never be perfect and I got strange intellisense errors from time to time. (Admittedly, last time I tested it is some years ago, probably improved by now). The other thing I didn't like was that the actual build is hidden from the user which always confused me (but again, my personal opinion only).
In vsCode the intellisense engine can use different underlying compilers. VisualTeensy configures it to use the same compiler as it uses for compilation. This makes intellisense much more reliable and usable. E.g. you can usually "F12" even into system libraries, the #defines are correctly interpreted and so on.
From KurtE: Then there is some integration stuff for SublimeTools that @FrankB and @defragster setup, which I also use some of the time.
Never really used it. One question: does this solution provide some intellisense features (error wiggles, code completion, jumping into definition of functions etc) or does it use Sublime as better editor only?
From KurtE: For me, one of my main things as I do all of this as a hobby and try to help out a little, so one of my strong preferences is that the IDE/Build system I use, produces the same results as the IDE... So that others who use the Arduino IDE can use it as well... And with many of these systems you end up with some subtle differences, like VisualMicro will use a library that ships with the Teensyduino IDE over the ones you install in your <arduino folders>/libraries folder.... Took me awhile to figure out why something was not working.
That's true indeed, before publishing something I usually try to compile with the A-IDE to verify. But since standard c++ is more stringent than the Arduino builder it usually just compiles. The other way round is more difficult. Especially if users make heavy use of the Arduino helpers.
Sorry for the long post in the wrong thread