error: 'Default' was not declared in this scope | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
error: 'Default' was not declared in this scope
June 7, 2016
8:07 pm
Avatar
dan07
Member
Members
Forum Posts: 5
Member Since:
September 20, 2015
sp_UserOfflineSmall Offline

Hello everyone,

 

I’ve been using Arduino Compatible Compiler for LabVIEW with Arduino Nano and I am currently using version 10.0.0.21.

 

I tried to compile and upload to the Arduino a simple code with digital read/write nested into a while loop with coupled case structures and I got the following message:

 

1.0.0.21, Arduino Nano

temp.ino: In function 'void setup()':

temp.ino:103:40: error: 'Default' was not declared in this scope

temp.ino:147:40: error: 'Default' was not declared in this scope

 

How should I proceed to solve this issue?

 

Regards,

 

dan07.

June 7, 2016
8:46 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Can you post your VI?

June 23, 2016
7:14 pm
Avatar
dan07
Member
Members
Forum Posts: 5
Member Since:
September 20, 2015
sp_UserOfflineSmall Offline

Steffan,

 

Sorry for the delay answering. I've been trying different approaches and I believe that I realized what the problem was.

The code has a Case Structure and the option Use default if unwired was activated for one of the tunnels. As long as I connected something to the tunnel and didn't use the Use default if unwired option anymore, the problem was gone.

 

Thanks for your help.

 

Daniel.

June 23, 2016
7:29 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Ah yes.  This is item #5 of the FAQ in the user manual:

 

5) Why do I get a compilation error when I right click at a unwired Case Structure tunnel and select the LabVIEW option "Use Default if Unwired"?

The Arduino Compatible Compiler for LabVIEW currently does not support the "Use Default if Unwired" option for Case Structures. In order to avoid a compilation error, you will have to right click at the unwired tunnel and create a constant to be wired to the tunnel, as illustrated below.

June 23, 2016
7:46 pm
Avatar
dan07
Member
Members
Forum Posts: 5
Member Since:
September 20, 2015
sp_UserOfflineSmall Offline

Thanks a lot for the response.

 

Now everything is fine and the code is running well.

September 17, 2018
3:35 pm
Avatar
AK7466
Guest
Guests

Hi. If I wire a string to case selector without any other terminals, I get a similar error that Default as not declared.

Please can you tell me what I am doing wrong? I have scanned the manuals, and can't find any reference to this.

I have attached / uploaded a simple  VI "Test Case.vi" which demonstrates this.

Thanks

 

Alan K.

September 17, 2018
11:28 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

You need to define a string in the Default case.  Although LabVIEW seems to allow deleting the string element, the Compiler does not.  It should look like this.  When you wire up a string to a new case structure, it automatically includes the default string element.

Case-Structure.pngImage Enlarger

sp_PlupAttachments Attachments
September 18, 2018
8:06 am
Avatar
AK7466
Guest
Guests

Many thanks Steffan.

Could I have found that in the manual somewhere?

On the topic of Case Structures, in the "Frequently Asked Questions" section of the manual, question 12) asks,

"Can I wire a string variable to the case selector terminal of a Case Structure?", and included in the reply is...

"It is recommended to use enumerated data types instead of string variables to wire to the case selector of a Case Structure."

So if I do a "Serial Read" of an incoming ASCII String, and want to execute different cases depending on the string, what is the best way to code this?

Thanks again for the great support.

Alan K.

September 24, 2018
10:24 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

I don't think this one is in the manual.  It is a corner case that LabVIEW allows for not setting a Default case whereas the converted Arduino C code requires a default case.

As far as a serial read with ASCII string, this is likely the best way to handle it, but you should always define a Default case.  Just be aware that ever case will require storing the ASCII string in RAM.  If you have a lot of cases this could take hundreds of bytes on an Arduino that only has 2k of RAM.  This statement in the help manual is emphasizing if you have the option to use enum/numeric datatypes for a case structure because then each case of the case structure would only require likely 1 byte of RAM instead of many bytes for each case.

September 25, 2018
8:30 am
Avatar
AK7466
Guest
Guests

Many thanks for the reply and explanation Steffan.

That is very helpful, and I will bear these limitations in mind.

Regards

Alan K.

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
8
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356