compiler limit exceeded while assembling user class; 255 fields allowed connect iq 258 used

Hi

SDK 3.1.4 on windows 10

I have a watch face program with this message when i compile the WF.

What is 255 fields   in my program

strings ? settings ? Property ? , variables in program

I understand the problem but i don't know where i must work to fix the problem

Where i can count this counter for other program whitch work correctly actually

Thanks for your help

Didier

Top Replies

  • I have numerous metrics where users should be able to choose from, but each metric requires a string.

    I have a similar problem for my datafields which support 100+ metrics (if you count modifiers…

  • Cutting back the number of stings by 3 to get back to 255 is the quickest solution right now.

    You realize that the original question about 258 strings is from 4 years ago (you responded to…

All Replies

  • Never seen this, but my first guess would be something with properties/settings..  In looking at the xml files for your app, where is it that you have 200+ different things?

    255 would be a logical limit as that's the max for an 8 bit value.

  • The compiler is seeing more than 255 symbols in a class or module. Don’t forget that the global scope is a module named $ and that resources are put into type-specific submodules under Rez (Rez.Strings, Rez.Layouts, ...).

    The error message should get updated to indicate what class/module is affected. Typically this isn’t necessary though. A quick peek at the code/resources should be enough to figure it out.

    You *may* be able to get more helpful information by compiling with the -g option. This tells the compiler to output an intermediary representation to the console. You mIgor be able to look at this to find the offender.

  • Hello and thank you for your first feedback. I tried to delete some string or properties, but I still have the 255 limit message, and I still use 258.

    What is strange is that I do not see the number 258 decrease even by removing strings. this limit must therefore be elsewhere.

    When I count all strings, properties, I am over 300 so well above 255.

    This confirms that the problem must be elsewhere, maybe in .mc files

    Currently I really have no idea where this limit is reached.

  • When I count all strings, properties, I am over 300 so well above 255.

    As I mentioned above, resources are grouped into modules. For instance, string resources are put into Rez.Strings. Given that they are grouped like this, you would need to have over 255 resources of a single type to run into this error.

    Given a closer look at the error message, it says the error occurred while assembling 'user class', not in 'globals', so I'm almost certain that the issue is with too many symbols (variables, constants, functions) in one of your classes.

    Did you try adding -g to the compile options as I suggested above? To do this, go to Window > Preferences > Connect IQ > Compiler > Compiler time options and add -g, then click OK and rebuild your project. When the build completes, go to the Console (in Eclipse) and click the little blue/white monitor icon, and select Connect IQ. That will show you the build log.

    The second section (labelled DATA) has information on each class/module (described in a CLASSDEF section). You want to find the one that has > 255 entries. It should be pretty easy to see. There will be more than 250 lines from the CLASSDEF and the following END marker.

  • Thanks. I will check this tonight

    Didier

  • Yes

    Thanks Travis i found where was the limit

    With this option i detected where was the problem

    It was it the code not in string

    Too much variables, functions in the code

  • Yes, one solution can be to set all your global variable in single class, you will save many entries.

  • Ran into this today.  My problem is with strings.

    ERROR: assembler: Compiler limit exceeded while assembling globals/Rez/Strings; 255 fields allowed, 257 found

    Is there any way to split the strings.xml file to overcome this limit?

  • it depends what you have in your strings.xml at the moment. Have a look here https://developer.garmin.com/connect-iq/core-topics/resources/ . It's not easy but it might be possible, but it depends on how you arrange your code/resources.

    When you start your app now, do you really need those 257 strings? Is it possible to get to all of them?

    Actually maybe Garmin should split the strings that we actually need in the watch from those that are only used in the settings (in Garmin Express / Garmin Connect) which probably accounts for most of your strings...

  • The 255 max gets back to the max of an unsigned 8 bit value. It also gets back to the design.