There’s an annoying subtlety in the Arduino IDE when using tabs (multiple files in the sketch), that was kindly explained by PaulS on the Arduino forums.
Any Arduino libraries that are needed by the files outside of the sketch (.ino) file must also be listed in the sketch file itself.
You cannot simply do this:
When you attempt to compile, you’ll get an error like,
In file included from test_junk_02.cpp:1: test.h:7: error: 'Servo' does not name a type
You must also include the library in the sketch:
The explanation that PaulS gave was the following:
The sketch is parsed for include files. The sketch, all included header files, and the corresponding source files, are copied to another directory for compiling. From that directory, library-based include files are NOT available unless they are included in the sketch and copied to the build directory.
In the Delphi IDE, when working on a project, you open a package (.dpk), then close the package. However, when you open the project at a later date the package “sticks” to the project. In other words, the package is listed in the Project Manager window. Sometimes the package becomes the default active project, so when you compile your project, the package is compiled rather than your project. This forces you to go to the Project Manager window and activate your project before you can compile. It’s annoying.
The cause of this is that when you close a project, the IDE remembers which windows you had open, breakpoints, and other IDE state information for that project. It does this by storing the layout in the desktop (.dsk) file. For some reason, even when you completely close the package file, the Delphi IDE remembers the package in the same way that it remembers the files you have open in the IDE. This does make sense on one hand. Packages are more than a source file, but less than a full-fledged project. However, packages have side effects that normal source files don’t. This is why the package seems to be “sticky”, showing up every time you reopen the project, and possibly interfering with your work on the project.
To get rid of the pesky “sticky” package there are two options. For both of these, do not have the project open in the Delphi IDE. If you do, you’ll end up overwriting your fix when you close the project and the IDE rewrites the desktop file.
If you don’t care about which windows you had open, breakpoints, etc. you can just delete the whole .dsk file. Bam!
On the other hand, if you want to preserve the IDE state without the “sticky” package, deleting the entire desktop file is too draconian. You’ll have to edit it. This is pretty simple. The desktop file is in Windows INI format. Open it up in your favorite text editor. (As an old Un*x head, I like vim.) Search for the name of the package’s file name, and delete the offending INI sections. Save the desktop. When you reopen the project, the IDE will not see any references to the package. Thus the pesky package will not show up anymore.