5

How can I create a workspace & projects so that either the Arduino IDE or the EclipseArduino IDE may be used to develop the project, interchangeably?

I have both IDEs installed and working but in separate workspaces.

I need:

  • One workspace that either IDE can understand and work in;
  • Either to IDE build with the physically same set of library sources;
  • Whichever IDE I open to see my sources as I last left them, regardless of which IDE I last used.

I want:

  • The source files to have conventional names - .C or .C++, not .pde or .ino;
  • Either IDE to build with the physically same set of library object modules;

My use-case is that I work in/with Eclipse, and I teach Arduino skills to people starting out with the Arduino IDE. I'd like to be able to prepare class work at home with Eclipse but open and project it in class with the Arduino IDE. It would be nice if I could demonstrate the two IDEs using the same code. Clearly, I could hack up a demonstration, but I'd rather do it honestly and without sync issues like having to apply twice any changes we made in class.


Update 20 Apr '16: At @Jantje's suggestion (in the comments below his answer), I created a github issue, "Importing an ArduinoIDE project with the New Sketch Wizard and using same sketch-name, failed." The new sketch would over-write the .ino file with a new, empty sketch.

That issue got fixed in the April 14, 2016 nightly and now works as his answer to this question says it does.

  • I came across to this issue, but I found out that it is very tricky to use eclipse with some libraries as they dont compile for "not understand it" or "not c standard". One way would be to code with Eclipse and coimpile with Arduino IDE which sounds stupid but... it works – max246 Nov 21 '15 at 17:48
  • I'm not sure why you want the source files to be named with conventional names (I mean I know exactly why I would want that, but…) – won't that break the compatibility with the Arduino IDE? It occurred to me that if Eclipse uses something like a standard Makefile that you could probably create a rule that would allow you to work with .ino files. – dlu Nov 23 '15 at 7:50
  • Help me please. I made changes - warnings appear, after I canceled the changes, warnings remain. youtube.com/watch?v=Y9doeAvnN70 – mihail Sep 14 '17 at 8:57
2

Your requirements for not having .ino files and wanting to be able to work with the Arduino IDE are conflicting. Assume we drop that requirement it is very much possible to do what you want.

The Arduino Eclipse plugin has been supporting .ino files for a long time now. You can simply compile Arduino IDE-made sketches. You do not have to make links and so make the folder where your Arduino IDE makes its sketches the workspace in Eclipse.

In Eclipse, for each sketch you want to edit, start the new sketch wizard and use a project name that is the same as the sketch name in the Arduino IDE.

Now you can work in the Arduino Eclipse plugin and the Arduino IDE on the same files.

Important: In Windows, if you use a version of the plugin from before March 3, 2016, you need to delete the .ino.cpp file before starting the Arduino IDE. In Linux, the Arduino IDE ignores this file, but in 1.6.7 on Windows (just tested it) the file gets picked up by the Arduino IDE. You need to restart the Arduino IDE to tell it the file is gone.

From March 3, 2016 onwards, the code in the .ino.cpp file is inside a #ifdef that is not defined in Arduino IDE.

  • Thanks, @jantje! Is the the .ino.cpp file an artifact of the Eclipse plugin? – JRobert Feb 23 '16 at 17:28
  • the .ino.cpp is indeed an artifact of the arduino eclipse plugin. – jantje Feb 23 '16 at 20:47
  • I found that the .ino.cpp is ignored by the arduino ide in linux but not on windows. Making the file hidden in windows (that is what the. stands for in linux) didn't help to hide the file for arduino ide in windows. – jantje Feb 24 '16 at 20:14
  • "start the new sketch wizard and use a project name that is the same as the sketchname in arduino ide." This fails for me - opeing the ino file in Eclipse, I see an empty sketch template, even though the file on disk has my actual code in it. – JRobert Feb 29 '16 at 20:47
  • If the code is there pressing F5 should make it visible. I may have had a auto refresh workspace when I tested it. – jantje Feb 29 '16 at 21:19
2

Are you willing / able to work with Xcode? There is a package called embedXcode that enables Arduino development on Macs – I'm just getting up to speed with it, but it does appear to allow you to work either in Xcode or with the Arduino IDE (the .ino file is present and is what you edit in Xcode). In my testing so far it appears that the easiest thing to do is to create a project using Xcode and then you can point the Arduino IDE at the project pretty easily, getting Xcode to pick up a sketch started in the Arduino IDE is currently beyond me.

From the point of view of your students I would think that you'd want to keep the .ino file rather than make them learn about the conventions of C or C++. It would also save you the hassle of somehow managing file names – although you could probably get make to do this for you.

I haven't looked into it at all, but I think you could do something similar with Atom (a quick Google found a blog post called Arduino Development in Atom Editor and an Atom package called nino that is described as a "Toolbelt for Arduino") or Emacs, or for that matter Vim is also like to have some Arduino support.

  • I want to use Eclipse both to remain platform-agnostic, and because I'm familiar with it. I get the point about using ,INO files, and that alone may make my request unrealistic, or at least require that I change file extensions when I go back and forth. I don't mind that the class see and use the magic that the Arduino IDE otherwise does behind the scenes. Just having the projects accessible by both IDEs would be a huge help. – JRobert Nov 23 '15 at 15:20
  • That makes total sense. Does Eclipse use something like a Makefile, seems like if it did there would be a way to teach it how to handle the .ino file. Or maybe it would be enough to create a symbolic link between the .ino and the matching .cc/.c++. – dlu Nov 23 '15 at 15:28
  • Symlink is the first thing I though of, too. Or Eclipse can be told to recognize .ino extensions. Makefiles: I'm sure it uses them but it auto-generates them. That's some magic that I'd rather not let out of its box! :) – JRobert Nov 23 '15 at 18:33
  • Wise, very wise. – dlu Nov 23 '15 at 20:37
  • On further reflection on the IDE's behind-the-scenes processing, I personally prefer the stricter language processing (i.e. no invisible fix-ups). More than "not minding" the class seeing the fixups, I prefer it. They should know what gets done on their behalf and be able to do it for themselves in the real-world. To that end, a switch would be welcome in Eclipse for sure, if not in the IDE as well, to turn off that hand-holding. Most people that stay nvolved will eventually outgrow the basic IDE and will need to know how to write the real language for themselves. – JRobert Mar 12 '16 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.