In one of the answers I received, I was told the cause of my error was in not putting my classes into separate .h/.cpp pairs. The respondent was completely wrong about this, but I now am working on a much larger project where I really do want to do this.
OK, I look for some way to create a file. I see, under the file menu, "New". Hmm...it doesn't create a new file, but a whole new project. OK, some more exploration reveals the "Add File" option in the Sketch menu. It will add an existing file to my project, but has no ability to creat one.
Hmmm...OK, I have Xcode installed. I go there, and in my project directory I create a header file, InstructionSequence.h. I save it. I return to the Arduino IDE, and tell it to add this file to my sketch. It asks me if I want to delete the existing InstructionSequence.h file. I try the "No" equivalent and get no useful result; I try the "Yes" equivalent, and it deletes the file. The file is now gone, without a trace, but it is also not in my project.
Why is there no option to create a file in the current project directory?
It appears that I will have to create this file in some other directory, copy it to my project, and then delete it from the other directory. This makes no sense whatsoever. Does anyone remember what the "I" in "IDE" stands for?
Therefore, I would request two minor changes to the IDE:
Send my source code to the compiler UNTOUCHED. This would require: (a) an option to disable the faulty code that generates erroneous programs and (b) complete and accurate documentation of what should be done to allow such programs to compile, such as including certain header files)
A way to create header and C++ source files as part of the IDE interface
Neither of these strike me as being particularly challenging.
joe
I use the Arduino IDE to compile and upload files but I use an external editor to create the code. There is an option in "Preferences" to use an external editor. Then the IDE just compiles the latest saved version of the file(s).
The exact same rules about naming files and the use of directories applies but it may be easier to see what is happening if you don't like the way the IDE does some things.
You write the .ino files exactly the same as you would in the IDE, only you're doing your work in an IDE you're more comfortable with. You simple use the IDE to compile and upload.
"My favorite external editor runs on Windows, and I do not have a MacBook version that runs under OS X. To get a Mac OS X version of my favorite editor will cost me $100. I do not see why I should have to pay $100 to fix somebody else's bugs. Also, I'm now retired, and I'd rather spend the money buying parts to play with, and not waste it because somebody doesn't know how to code an IDE."
Does that make it clear?
One of my mottos has always been "I don't use free software because I can't afford it". So here's a case where the "free" software will cost me $100 because it is buggy. Then, if I get the editor (or, for example, I use the Xcode editor), there is obviously a set of #include files I must mention, which probably get inserted by the IDE, because when I tried this (using the Xcode editor), a very simple file gave me an error
#include "RandInRange.h"
int RandInRange(int low, int high)
{
// low must be a value >= 0
// high must be a value > low, ideally > low+1
int range = high - low;
int rn = random(); // <=== error on this line
rn %= range;
rn += low;
return rn;
} // RandInRange
This tells me that "random" is undefined Not terribly surprising, because if the files are sent to the compiler untouched (which is what I want) then any gratuitous #includes were not added. But I do not know what to add to make it compile, nor have I been able to discover any documentation on this.
There really has to be an option other than using an external editor that will allow me to have the IDE send the files untouched, and there MUST be a description of what is necessary to explicitly include to make such files compile correctly.
joe
"I cannot use a Windows machine because the new Windows machines all come with Windows 8, which due to a complete misunderstanding of the needs of the customer base will not load drivers that are unsigned, which includes most of the drivers I need to download code to embedded systems. After wasting a month because I couldn't work around all the bugs in the Windows design, I got a MacBook Air, which has many advantages over my laptop, not the least of which is its very light weight, important to me now that age and a long-term neuromuscular degenerative condition have made carrying the heavy laptop nearly impossible, or at least seriously painful to a level I do not wish to experience. It was only after I started using the IDE that I discovered that it performs erroneous transformations to my code. They must be erroneous, because programs I know to be correct fail with obscure error messages, and I am assured this is entirely due to the IDE preprocessing. However, there is not a mode that lets me use the IDE editor and leave the files untouched, and if the files remain untouched, there are apparently secret #include files I must add myself. I have no problem adding them, if only I knew what they were. I have been unable to discover what they are."
flounder:
"I cannot use a Windows machine because the new Windows machines all come with Windows 8
flounder:
Well, what I should have said was
"My favorite external editor runs on Windows, ... To get a Mac OS X version ... will cost me $100. ... I'm now retired, and I'd rather spend the money buying parts to play with,
As far as here I am with you 100%
One of my mottos has always been "I don't use free software because I can't afford it".
but this sounds like Microsoft / Commerical Software propaganda.
There is a huge amount of rock-solid open source software available for Linux - and a Mac is just Linux in a party frock.
Of course it is entirely your choice whether you prefer complaining or finding a solution.
A great multi-platform editor I've recently started using is Atom, made by some folks over at GitHub. So far it's pretty nice, and you can always install packages/themes to suit your liking right from the editor itself with one click..
I don't understand how you're having problems accepting the oddities of working with Arduino if you have 20+ years of C++ experience. I've only had a few years of it myself (was more-so into C#) and I haven't seen anything in Arduino examples/tutorials that I don't understand or can't accept. Maybe you're over-thinking things? It seems like you're making it harder on yourself by over-complicating issues that you're having with the language. The issues you're having are with C++, which you should have enough experience in to overcome them.
Not trying to stir up any emotions or arguments, or anything like that. You simply can't be helped if you're fighting yourself and the people trying to help you.
flounder:
So the concept formerly known as "file" is now called "tab". Who would have guessed?
The file is loaded into a tab in the IDE. Is there a problem with that?
One of my mottos has always been "I don't use free software because I can't afford it".
Well, I've made a motto to stop paying $100 for software that is inferior to what the Open Source movement distribute for free. Their motive is to make good software. Commercial software providers' motive is to make money, by doing as little as possible to support their products.
So here's a case where the "free" software will cost me $100 because it is buggy.
So commercial software doesn't have bugs. In what universe?
I cannot use a Windows machine because the new Windows machines all come with Windows 8, which due to a complete misunderstanding of the needs of the customer base will not load drivers that are unsigned, which includes most of the drivers I need to download code to embedded systems. After wasting a month because I couldn't work around all the bugs in the Windows design ...
So just run by me again why you can't afford to use free software? The Windows software doesn't exactly seem to be meeting your requirements.
Just as an example, ffmpeg is a program that runs on Windows, Mac and Linux, for free, that converts videos from one format to another. Of course, if you are silly (like I have been in the past) you pay hundreds of dollars for some proprietary app that does the same thing. And then you are asked to "upgrade" for more money every couple of years.
I have been using Gedit on Linux for a long time and recently I came across Geany which I have now switched to.
I was about to have a look at Atom (which @DivinityArcane mentioned) until I saw that it reports metrics to Google. If they want metrics let them pay for my broadband connection.
Geany is a good editor. I used it for a few years because of easy of use and the customizablity with build/compile hotkeys.
Robin2:
until I saw that it reports metrics to Google
You can disable metrics reporting in settings. Go to settings > packages, and under "Install packages" type 'metrics'. The first package that shows up will be the internal reporting package. Click "settings" for that package, then click disable.
The FAQ tells people it can be disabled, but I guess people don't make it that far.