The code below compiles just fine in the Arduino IDE. But, it fails in Eclipse / Sloeber. The error messages from Eclipse are shown. I’m thinking that Arduino is doing “something” behind the scenes to help me out. But, Eclipse doesn’t do that “something” for me and I need to do it myself.
Also, the complaints seem to be originating from an automatically-generated .cpp file. So, I’ve included that too.
08:30:14 **** Build of configuration Release for project yyy ****
"C:\\sloeber\\arduinoPlugin\\tools\\make\\make" all
'Building file: ..\.ino.cpp'
'Starting C++ compile'
"C:\sloeber\/arduinoPlugin/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.20\cores\arduino" -I"C:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.20\variants\standard" -MMD -MP -MF".ino.cpp.d" -MT".ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "..\.ino.cpp" -o ".ino.cpp.o"
..\.ino.cpp:11:1: error: 'myEnum' does not name a type
myEnum returnEnum(myEnum x) ;
^
subdir.mk:24: recipe for target '.ino.cpp.o' failed
make: *** [.ino.cpp.o] Error 1
08:30:14 Build Finished (took 632ms)
Automatically-generated .cpp file:
#ifdef __IN_ECLIPSE__
//This is a automatic generated file
//Please do not modify this file
//If you touch this file your change will be overwritten during the next build
//This file has been generated on 2017-11-17 08:30:07
#include "Arduino.h"
#include "Arduino.h"
void setup() ;
void loop() ;
myEnum returnEnum(myEnum x) ;
#include "yyy.ino"
#endif
Delta_G:
You need to write your own function declaration. The Arduino stuff is trying to generate it for you but it's putting it up before the enum definition.
Isn't that a proper function declaration I have right below the enum definition?
OK, that worked. Thankfully, clicking the File --> New --> Arduino Sketch sequence provides a “Default cpp File” option. So, it still does the work of pulling in the correct board-dependent stuff. I could never configure all the toolchain and compiler options stuff myself.
Anyway, for this simple-minded example I didn’t even need .h file.
I've been using the ATOM plugin, which is a very rich dev tool...
I did give it a quick look. In my opinion (and this may be incorrect / unfair), it involves too much dorking around: install python, install Atom, install Platform IO.
Worse still, it looks like you need to mess around with a Command Line Interface and manually edit .ini files. This is 2017, not 1977.
Like I said, there’s a good chance I’m off-base here. But, that was my impression after poking around for 30 minutes.
“Better” is the enemy of “Good Enough”. Arduino IDE is not quite good enough, so I’m moving on to Eclipse. Here I’ll squat until it’s not good enough, which will probably be never.
Once I’m comfortable writing and building code in this environment, I will attempt to tackle version control.
from where I live it is about ten light years away from good enough, once you get past blinking an LED!!
Perhaps now with the re-unification of Arduino, they will set about choosing wether to buy, develop or invest in (open-source) an IDE for the 20th century.