Still trying to understand cpp and h files.

For a given sketch, I tried making minor changes to a cpp file but, my sketch did not seem to pick it up. Does the revised cpp file need to be in the same folder as the sketch? Perhaps I should rename the cpp file and then revise the h file to use the renamed cpp.

Does the revised cpp file need to be in the same folder as the sketch?

That is the easiest approach. It will appear as a tab in the Arduino editor and will automatically be included.

When you say Arduino editor, are you referring to IDE or one of the others? It didn't seem to work in IDE.

Works fine for me, using IDE version 1.8.2.

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"

Build options changed, rebuilding all
X:\~Arduino\libraries\X10\examples\x10_blinkTEST\x10_blinkTEST.ino:16:21: fatal error: x10TEST.h: No such file or directory

 #include <x10TEST.h>

                     ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

The x10TEST.h file is in the same folder as the x10_blinkTEST.ino file.

@Bugman1400, do not cross-post. Do not hijack. Other thread locked.

Lesson learned.......and, I have now read the nickgammon posts on how to post properly!

Try using quotes instead

#include "file.cpp"

The ide does not recognize changes to ANY of the files open in the IDE if those changes are made outside the ide, i.e. with a different text editor

The only way to 'pick up' such changes is to close the ide and re-open your sketch.

Or manually paste the new contents into the file open in the IDE.

It is really annoying - I wish the IDE developers would add an automatic file refresh feature when the IDE detects a change in the open file's data/time stamp.

boylesg:
I wish the IDE developers would add an automatic file refresh feature when the IDE detects a change in the open file's data/time stamp.

You'll be happy to know that is on its way:

If you want to try it out there are test builds available at the link above. It sounds like some further testing is desired before merging it so if you to use it please comment on that pull request or here if you discover any problems.

The existing way to do this is to do File > Preferences > Use External Editor (check) > OK. That will cause the IDE to notice all changes that happen to the sketch files outside of the editor. You will not be able to edit the file inside the editor but why would you want to anyway? This also allows you to use a more advanced editor instead of the fairly basic one the IDE provides.

Bugman1400:
The x10TEST.h file is in the same folder as the x10_blinkTEST.ino file.

In that case, use

#include "x10TEST.h"

Angle brackets are for include files that are in the library folders.

pert:
You'll be happy to know that is on its way:
https://github.com/arduino/Arduino/pull/6074
If you want to try it out there are test builds available at the link above. It sounds like some further testing is desired before merging it so if you to use it please comment on that pull request or here if you discover any problems.

The existing way to do this is to do File > Preferences > Use External Editor (check) > OK. That will cause the IDE to notice all changes that happen to the sketch files outside of the editor. You will not be able to edit the file inside the editor but why would you want to anyway? This also allows you to use a more advanced editor instead of the fairly basic one the IDE provides.

For me the situation where the lack of this feature is annoying is that I have a bunch of common classes like CString.h/cpp.

Rather than put these in a library I just add them to each sketch as needed.

I also keep a copy of them in a separate folder 'Common' for the purposes of Microsoft Visual Soure Safe.

So sometimes I have a couple of sketches open that both use CString.h/cpp

And occasionally I add a new function to my CString class in one sketch, then copy the files back to 'Common' and then to the other sketch I have open.

It is not a frequent occurrence but never the less a real annoyance when it arises.