Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Looks like bug. Weird behavior of enum types in VisualMicro (Read 930 times)
Evgeny Zhekaus
Junior Member
**
Offline


Posts: 38
Joined: Sep 19th, 2018
Looks like bug. Weird behavior of enum types in VisualMicro
Jan 26th, 2020 at 9:21am
Print Post  
Shocked
An innocent code bellow produces an ugly error message “Sketch2.ino: 2:13: error: variable or field 'myFunc' declared void
   Buttons btn = OK
   ^~~~~



```
enum Buttons { OK, CANCEL };
Buttons btn = OK;

void myFunc(Buttons btn)
{
}

void setup()
{
}

void loop()
{
}
```

Arduino IDE compiles it without errors.
« Last Edit: Jan 26th, 2020 at 9:22am by Evgeny Zhekaus »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Looks like bug. Weird behavior of enum types in VisualMicro
Reply #1 - Jan 26th, 2020 at 2:35pm
Print Post  
Switch off Generate Prototypes in the vMicro project properties

or add a c++ prototype as follows

Code
Select All
enum Buttons { OK, CANCEL };
Buttons btn = OK;

//prototype between user type and function
void myFunc(Buttons btn);

void myFunc(Buttons btn)
{
}

void setup()
{
}

void loop()
{
}
 



or

Upgrade to the latest vmicro here

https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES


« Last Edit: Jan 26th, 2020 at 2:36pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Evgeny Zhekaus
Junior Member
**
Offline


Posts: 38
Joined: Sep 19th, 2018
Re: Looks like bug. Weird behavior of enum types in VisualMicro
Reply #2 - Jan 26th, 2020 at 4:07pm
Print Post  
Thank you so much! It works.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint