Using the latest Visual Micro on Visual Studio 2017, and Arduino IDE 1.8.3.
Using
this fork of StandardCplusplus. Target platform is a Pro Micro.
In the Arduino IDE, the project compiles without any problems or warnings, and it runs normally. In Visual Micro, there are no syntax errors in the IDE, but I get a range of strange errors:
Compiling 'keypad' for 'Arduino/Genuino Micro'
keypad.ino: 3:19: error: 'MacroType' was not declared in this scope
Macro createMacro(MacroType macro)
keypad.ino: 6:16: error: variable or field 'playMacro' declared void
void playMacro(MacroType nextMacro)
keypad.ino: 6:16: error: 'MacroType' was not declared in this scope
keypad.ino: In function Macro createMacro(MacroType)
keypad.ino: 47:34: error: 'Macro createMacro(MacroType)' redeclared as different kind of symbol
Error compiling project sources
Macro createMacro(MacroType macro) {
Build failed for project 'keypad'
keypad.ino:3: note previous declaration Macro createMacro
Macro createMacro(MacroType macro)
keypad.ino: In function void playMacro(MacroType)
keypad.ino: 244:37: error: no match for call to '(Macro) (MacroType&)
Macro macro = createMacro(nextMacro)
keypad.ino: 3:19: error: 'MacroType' was not declared in this scope Line 3 is #include <vector>?
keypad.ino: 6:16: error: variable or field 'playMacro' declared void Actual line: #include "Macro.h"
Not sure what it wants here, as playMacro is at line 243
keypad.ino: 6:16: error: 'MacroType' was not declared in this scope Actual line: #include "Macro.h"
Yeah, MacroType is defined below, but Macro.h doesn't have anything to do with the MacroType enum.
keypad.ino: 47:34: error: 'Macro createMacro(MacroType)' redeclared as different kind of symbol It wasn't declared before?
keypad.ino:3: note previous declaration Macro createMacro Why does it go back again?
keypad.ino: 244:37: error: no match for call to '(Macro) (MacroType&) Not sure what's going on any more.
This problem started when I made a MacroType enum (to get rid of magic numbers/IDs), but the same source is compiled by the Arduino IDE. Closing and re-opening Visual Studio, switching between release and debug builds didn't change anything.
I attached the source code.