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 ENUM Error (Read 586 times)
Christopher Cooper
Junior Member
**
Offline


Posts: 22
Joined: Jul 13th, 2020
ENUM Error
May 20th, 2024 at 12:09pm
Print Post  
Hi All,

I am getting the following error in Visual Studio Community Edition with a Sketch someone else has written. There are only a couple of posts about this and Visual Micro, none of which apply.

"A value of type X cannot be assigned to an Entity of type X" 

These are the Enum variables listed.

Code (C++)
Select All
// ******************* Pack Status / State Arrays ******************* //
enum PackState { OFF, BOOTING, BOOTED, POWERDOWN };
enum PackState STATUS;

enum WandState { WANDOFF, ON, ON_PACK };
enum WandState WANDSTATUS;

enum WandSLEDState { ALLOFF, WANDONLY, NORMAL, FIRING, WARNING, FASTWARNING, VENTSTATE, STREAMCROSS };
enum WandSLEDState WANDLEDSTATUS;

enum PackTheme { MOVIE, STASIS, SLIME, MESON, CHRISTMAS };
enum PackTheme THEME; 



The sketch still compiles and all works, its just annoying as I have the red marks throughout the sketch which makes it difficult to drill down on actual errors.

Thanks.
« Last Edit: May 20th, 2024 at 12:10pm by Christopher Cooper »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2338
Joined: Feb 13th, 2019
Re: ENUM Error
Reply #1 - May 20th, 2024 at 12:17pm
Print Post  
Thanks for the report.

Can you attach the complete build log with the settings enabled as shown at the top of the page?
  
Back to top
 
IP Logged
 
Christopher Cooper
Junior Member
**
Offline


Posts: 22
Joined: Jul 13th, 2020
Re: ENUM Error
Reply #2 - May 20th, 2024 at 2:19pm
Print Post  
HI,

Apologies, I thought you wouldn't need the file.

I have sent it by email.

Regards,

Christopher

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2338
Joined: Feb 13th, 2019
Re: ENUM Error
Reply #3 - May 20th, 2024 at 2:36pm
Print Post  
We don't always need it, but its always useful to see more detail about the environment and versions of boards etc..

Currently I can't reproduce the Intellisense errors for the Arduino Nano Every with that code.

Can you try closing VS completely, then delete the ".vs" folder from the solution folder, and then reopening VS?
  
Back to top
 
IP Logged
 
Christopher Cooper
Junior Member
**
Offline


Posts: 22
Joined: Jul 13th, 2020
Re: ENUM Error
Reply #4 - May 20th, 2024 at 4:36pm
Print Post  
Hi,

I have completed that, but unfortunately, the errors still show.

latest build log attached.

Regards,

Christopher
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2338
Joined: Feb 13th, 2019
Re: ENUM Error
Reply #5 - May 21st, 2024 at 11:36am
Print Post  
Thanks for the update.

We will try to find a solution, though it may be an issue with the Intellisense system within VS, beyond the instructions we feed it.

One code change as a workaround is when setting the values to use the fully qualified names, e.g. STATUS = PackState:ShockedFF;  which seems to resolve the issue for intellisense and still compile.
  
Back to top
 
IP Logged
 
Christopher Cooper
Junior Member
**
Offline


Posts: 22
Joined: Jul 13th, 2020
Re: ENUM Error
Reply #6 - May 21st, 2024 at 7:28pm
Print Post  
Everyday is a lesson.

That solved it thank you.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint