i'm a C++ developer for about 20years, i used many ide's like clion, qt creator, visual studio, ...
Now i'm playing around with arduino to teach my son in programming and electronics.
I read about the sense of the ino file, the special preprocessor and so on but i haven't found yet a solution for the problem, that the ide is not showing any file, no ino file no folders nor files inside the folders.
I would expect s.th. like this with the possibility to open the files directly by double clicking
In cppTest folder the ino file is located as well as a folder called include containing a .h file and src folder containing a .cpp file.
To edit the .h and .cpp file i had to drag n drop them into the arduino ide, then i created a simple class, included it in the ino file, instanciated it and called a function of the class. Compiler and linker are satisfied.
Question, why are files and folders hidden and why can i not open any file via file open from the menu?
Further i miss the possibility to define pathes for include, for librarys and so on to avoid typing the folder names in the include statement.
You can configure Arduino IDE to behave that way if you like. I'll provide instructions:
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Check the box next to ☐ Show files in sketches.
Click the "OK" button.
Please note that the unit Arduino IDE works with is the Arduino sketch project. An Arduino sketch is a folder, not a file, so all files from the root of the sketch folder are always open in Arduino IDE, just as the code of all those files is part of the sketch program. You can't pick and chose files to open as you would with a general purpose editor.
Arduino IDE does support placing additional non-.ino code files under the src subfolder of the sketch, and these are only opened in the IDE on demand when you select them from the Sketchbook view or via the "Go to Definition" feature.
You should not ever be typing absolute folder names in your #include directives in Arduino sketches. Relative paths should only be used for files within the project (e.g., src/SomeHeader.h).
Arduino IDE has a library discovery feature. Libraries are installed by the IDE under several specific folders on your computer. At the start of a compilation operation, Arduino IDE searches through all the installed libraries for a header file that matches each #include directive in the sketch program, and then automatically adds the path of that library in a -I flag in the compilation commands. It also compiles all the source files in each discovered library. This means that #include directives in Arduino sketches, and even libraries, are typically only for a filename, without any other path components.
Thanks for the quick reply!
The simple checkbox did the trick to show also files. Thanks and sorry for my blindness.
I never use absolute pathes. "Librarys" are one story, for me the code of a "library" ends in a .lib, .a or .dll file. When i create a class and the code gets compiled and afterwards linked, there is not such a library file therefore i struggle/wonder a little bit, when the word "library" is used in context of c++ classes.
I'm lazy and it makes the code easyer to read (in my opinion) when i can avoid to type s.th. like #include "../include/myNiceClass.h" (in the class cpp)
or #include "include/myNiceClass.h" (in the ino file)
But this is only nice to have, and completely ok for a free of charge ide!