CS0246 CEnhancedCheckbox compile error

RichardW

Member
Licensed User
Longtime User
Updated to 6.80 and encountered one glitch when compiling myQuotes.sbp for windows (optimized). I get "external compiler error CS0246 the type or namespace 'CEnhancedCheckbox' could not be found".

This occurs for CEnhancedCheckbox and for CEnhancedRadioBtn.

The error does not occur when compiling for the device.

I can get around this my changing the offending from:

Case "checkbox": Control(ary1(1), checkbox).text = ary1(2)
Case "radiobtn": Control(ary1(1), RadioBtn).text = ary1(2)
to
Case "checkbox": Control(ary1(1)).text = ary1(2)
Case "radiobtn": Control(ary1(1)).text = ary1(2)
 

RichardW

Member
Licensed User
Longtime User
CS0246 error sample sbp

Here is an example. I just tried to compile it for Windows with optimized on and I get the 2 errors for "checkbox" and "radiobtn".
 

agraham

Expert
Licensed User
Longtime User
It's a compile time reference problem. Presumably Erel has "enhanced" something in the optimising compiler in version 6.80 as you imply it compiled in version 6.50. As your project seems to not have either a CheckBox nor a RadioBtn control the optimising compiler is not adding the code for them but is trying to reference that missing code in the Control statement. If you add both a CheckBox and a RadioBtn to your Form1 the problem goes away.

Over to you Erel - :)
 

RichardW

Member
Licensed User
Longtime User
Thanks for the explanation.

It never occurred to me that the absence of a control(s) could result in confusion to the compiler.

This code is part of my generic language subroutine which is meant to read a text file and update the indicated controls' text display. As you noted myQuotes does not use checkboxes or radio buttons.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
As agraham wrote, the optimized compiler doesn't add code for control types which are not used.
If you don't add a checkbox with the designer or with AddCheckBox keyword then there is no way that such a control will exist during runtime. So the compiler doesn't add the unnesseccary code.
I didn't check it but I guess that this code will also fail in V6.50.
 
Top