Home AMX User Forum AMX General Discussion
Options

Odd Compiler Error_

DEFINE_VARIABLE
VOLATILE CHAR cTX_Queue[HVAC_ZONES * 128] ;
or
DEFINE_VARIABLE
VOLATILE CHAR cTX_Queue[HVAC_ZONES * 64] ;
results in this:
ERROR: file\path...... C10219: Array [CTX_QUEUE] must have an initializer if bounds are not specified

While the same thing with a number from 1-63 or 65-127 or 129-256 compiles just fine. I didn't actually try every number but everything I did try other than 64 or 128 did work.

HVAC_ZONES is an integer constant of 4.

Comments

  • Options
    I don't have it open and set up to test, but memory tells me that you aren't allowed to do variable or constant math inside a variable declaration. I think it does allow direct numeric math though.

    Edit: I re-read your post and now understand what you are saying... it was the number and not the constant that it didn't like. That's pretty weird!
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    Looks like you found some sort of bug.

    You can change HVAC_ZONES and/or your multiplier to any numbers but if when you multiply the two and the result is a multiple of 256 the compiler chokes. If it's not a multiple of 256 the compiler is happy.

    Odd...
  • Options
    a_riot42a_riot42 Posts: 1,624
    vining wrote: »
    DEFINE_VARIABLE
    VOLATILE CHAR cTX_Queue[HVAC_ZONES * 128] ;
    or
    DEFINE_VARIABLE
    VOLATILE CHAR cTX_Queue[HVAC_ZONES * 64] ;
    
    results in this:


    While the same thing with a number from 1-63 or 65-127 or 129-256 compiles just fine. I didn't actually try every number but everything I did try other than 64 or 128 did work.

    HVAC_ZONES is an integer constant of 4.

    Odd. As in, make HVAC_ZONES an odd number.
    Paul
  • Options
    try this,

    DEFINE_VARIABLE
    VOLATILE CHAR cTX_Queue[(HVAC_ZONES * 128) + (256 - 256)] ;

    and it will compile.
    credits to AMX support Germany for this workaround.
  • Options
    viningvining Posts: 4,368
    Did they have a theory behing that? In this instance it's easier to make the queue large or smaller since it does't really matter but let them play with this:
    DEFINE_CONSTANT //NUMBERS OF MIs, H48 AND RF LNIKS   <------------------------------------- CHANGE VALUES IN HERE!!!! FOR JOB ---------->
    
    //NUMBER OF PROCESSORS		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_TOTAL_NUM_PROCs		= 1 ;   //TOTAL NUMBER OF PROCESSORS IN THE SYSTEM.
    //PROCESSOR NUMBERS & COUNT	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_PROCESSOR_1			= 1 ;   //PROCESSOR 1 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3)
    HWI_PROCESSOR_2			= 2 ;   //PROCESSOR 2 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3)
    HWI_PROCESSOR_3			= 3 ;   //PROCESSOR 3 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3)
    HWI_FIND_TOTAL			= 4 ;   //USE TO RETURN TOTALS FOR A PARTICULAR PROCESSOR OF MI's, H48's OR RF.
    //VARIOUS COMM LINKS		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_MI_LINK			= 1 ;   //LINK FOR MI's ALWAYS 1 AND ONLY ONE.
    HWI_H48_LINK			= 4 ;   //MAKE 0 IF NO H48's
    HWI_KP_LINK_1			= 5 ;   //MAKE 0 IF NOT USED
    HWI_KP_LINK_2			= 6 ;   //MAKE 0 IF NOT USED
    HWI_KP_LINK_3			= 0 ;   //IF NO H48 AND MORE KEYPADS THAN 5 & 6 WILL ALLOW THEN MAKE 4 OTHERWISE LEAVE AS 0.
    HWI_RF_TYPE_DIMMER		= 1 ;   //ADDRESS PORTION THAT INDICATES THE DEVICE IS A RF DIMMER/SWITCH TYPE DEVICE
    HWI_RF_TYPE_KEYPAD		= 2 ;   //ADDRESS PORTION THAT INDICATES THE DEVICE IS A RF KEYPAD TYPE DEVICE
    HWI_RF_TYPE_REPEATER		= 3 ;   //ADDRESS PORTION THAT INDICATES THE DEVICE IS A RF REPEATER TYPE DEVICE
    HWI_RF_LINK 			= 8 ;   //RF DEVICE LINK ALWAYS 8 AND ONLY ONE.
    //OUTPUTS PER INTERFACE		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_NUM_MI_DEVICES		= 32 ;  //MAX NUMBER OF OUTPUTS PER MI (PANEL) 8 MODULES X 4 OUTPUTS.
    HWI_NUM_H48_DEVICES		= 48 ;  //NUMBER OF DEVICES PER H48 BOARD, SHADES OR MAESTRO DIMMERS.
    HWI_NUM_RF_DEVICES		= 64 ;  //NUMBER ODF DEVICES PER RF LINKS, 1 RF LINK PER PROCESSOR.
    //PROCESSOR 1 GROUP             ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI1_NUM_MIs			= 2 ;  	//0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 1.  (MAX 16)
    HWI1_NUM_H48s			= 2 ;  	//0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 1.  (MAX 4)
    HWI1_NUM_RF_LINKS		= 0 ;  	//0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS, ADD ANOTHER PROCESSOR GROUP.  (MAX 1) 
    //HWI1_MAX_OUTPUTS		= ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    //PROCESSOR 2 GROUP		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI2_NUM_MIs			= 0 ;  	//0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 2.  (MAX 16)
    HWI2_NUM_H48s			= 0 ;  	//0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 2.  (MAX 4)
    HWI2_NUM_RF_LINKS		= 0 ;  	//0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS, ADD ANOTHER PROCESSOR GROUP.  (MAX 1) 
    //HWI2_MAX_OUTPUTS   		= ((HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    //PROCESSOR 3 GROUP		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI3_NUM_MIs			= 0 ;  	//0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 3.  (MAX 16)
    HWI3_NUM_H48s			= 0 ;  	//0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 3.  (MAX 4)
    HWI3_NUM_RF_LINKS		= 0 ;  	//0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS.  (MAX 1) 
    //HWI3_MAX_OUTPUTS		= ((HWI3_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    //TOTAL SYSTEM ALL PROCESSORS	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   
    HWI_TOTAL_MI_OUTPUTS		= ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI3_NUM_MIs * HWI_NUM_MI_DEVICES)) ;
    HWI_TOTAL_H48_OUTPUTS		= ((HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_H48s * HWI_NUM_H48_DEVICES)) ;
    HWI_TOTAL_RF_OUTPUTS		= ((HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    

    The above compiles fine including the last 3 constants but this next line doesn't:
    HWI_TOTAL_OUTPUTS		= (HWI_TOTAL_MI_OUTPUTS + HWI_TOTAL_H48_OUTPUTS + HWI_TOTAL_RF_OUTPUTS) ;
    
    The compiler throws this error:
    ERROR: C:\filepath...\Netinx_Code\VAV_HWI.axi(98): C10539: Identifier [HWI_TOTAL_MI_OUTPUTS] undefined
    So I just comment it out and use:
    HWI_TOTAL_OUTPUTS		= 160 ;
    
    Obviously it defeats the prupose of going through all this crap.

    If they figure it out I'll buy them ein bier at the next Kieler Woche. Actually not since I don't drink anymore and I won't be going to Kiel. The idea is very tempting though.
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    vining wrote: »
    Did they have a theory behing that? In this instance it's easier to make the queue large or smaller since it does't really matter but let them play with this:
    DEFINE_CONSTANT //NUMBERS OF MIs, H48 AND RF LNIKS   <------------------------------------- CHANGE VALUES IN HERE!!!! FOR JOB ---------->
    
    //NUMBER OF PROCESSORS		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_TOTAL_NUM_PROCs		= 1 ;   //TOTAL NUMBER OF PROCESSORS IN THE SYSTEM.
    //PROCESSOR NUMBERS & COUNT	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_PROCESSOR_1			= 1 ;   //PROCESSOR 1 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3)
    HWI_PROCESSOR_2			= 2 ;   //PROCESSOR 2 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3)
    HWI_PROCESSOR_3			= 3 ;   //PROCESSOR 3 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3)
    HWI_FIND_TOTAL			= 4 ;   //USE TO RETURN TOTALS FOR A PARTICULAR PROCESSOR OF MI's, H48's OR RF.
    //VARIOUS COMM LINKS		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_MI_LINK			= 1 ;   //LINK FOR MI's ALWAYS 1 AND ONLY ONE.
    HWI_H48_LINK			= 4 ;   //MAKE 0 IF NO H48's
    HWI_KP_LINK_1			= 5 ;   //MAKE 0 IF NOT USED
    HWI_KP_LINK_2			= 6 ;   //MAKE 0 IF NOT USED
    HWI_KP_LINK_3			= 0 ;   //IF NO H48 AND MORE KEYPADS THAN 5 & 6 WILL ALLOW THEN MAKE 4 OTHERWISE LEAVE AS 0.
    HWI_RF_TYPE_DIMMER		= 1 ;   //ADDRESS PORTION THAT INDICATES THE DEVICE IS A RF DIMMER/SWITCH TYPE DEVICE
    HWI_RF_TYPE_KEYPAD		= 2 ;   //ADDRESS PORTION THAT INDICATES THE DEVICE IS A RF KEYPAD TYPE DEVICE
    HWI_RF_TYPE_REPEATER		= 3 ;   //ADDRESS PORTION THAT INDICATES THE DEVICE IS A RF REPEATER TYPE DEVICE
    HWI_RF_LINK 			= 8 ;   //RF DEVICE LINK ALWAYS 8 AND ONLY ONE.
    //OUTPUTS PER INTERFACE		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI_NUM_MI_DEVICES		= 32 ;  //MAX NUMBER OF OUTPUTS PER MI (PANEL) 8 MODULES X 4 OUTPUTS.
    HWI_NUM_H48_DEVICES		= 48 ;  //NUMBER OF DEVICES PER H48 BOARD, SHADES OR MAESTRO DIMMERS.
    HWI_NUM_RF_DEVICES		= 64 ;  //NUMBER ODF DEVICES PER RF LINKS, 1 RF LINK PER PROCESSOR.
    //PROCESSOR 1 GROUP             ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI1_NUM_MIs			= 2 ;  	//0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 1.  (MAX 16)
    HWI1_NUM_H48s			= 2 ;  	//0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 1.  (MAX 4)
    HWI1_NUM_RF_LINKS		= 0 ;  	//0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS, ADD ANOTHER PROCESSOR GROUP.  (MAX 1) 
    //HWI1_MAX_OUTPUTS		= ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    //PROCESSOR 2 GROUP		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI2_NUM_MIs			= 0 ;  	//0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 2.  (MAX 16)
    HWI2_NUM_H48s			= 0 ;  	//0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 2.  (MAX 4)
    HWI2_NUM_RF_LINKS		= 0 ;  	//0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS, ADD ANOTHER PROCESSOR GROUP.  (MAX 1) 
    //HWI2_MAX_OUTPUTS   		= ((HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    //PROCESSOR 3 GROUP		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    HWI3_NUM_MIs			= 0 ;  	//0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 3.  (MAX 16)
    HWI3_NUM_H48s			= 0 ;  	//0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 3.  (MAX 4)
    HWI3_NUM_RF_LINKS		= 0 ;  	//0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS.  (MAX 1) 
    //HWI3_MAX_OUTPUTS		= ((HWI3_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    //TOTAL SYSTEM ALL PROCESSORS	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   
    HWI_TOTAL_MI_OUTPUTS		= ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI3_NUM_MIs * HWI_NUM_MI_DEVICES)) ;
    HWI_TOTAL_H48_OUTPUTS		= ((HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_H48s * HWI_NUM_H48_DEVICES)) ;
    HWI_TOTAL_RF_OUTPUTS		= ((HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    

    The above compiles fine including the last 3 constants but this next line doesn't:
    HWI_TOTAL_OUTPUTS		= (HWI_TOTAL_MI_OUTPUTS + HWI_TOTAL_H48_OUTPUTS + HWI_TOTAL_RF_OUTPUTS) ;
    
    Everything compiles fine for me with Netlinx Studio version 3.1.0.374
  • Options
    viningvining Posts: 4,368
    Hmmm, i'll have to see what i'm running and update.

    Thanks for checking it.
  • Options
    viningvining Posts: 4,368
    Turns out I was running build 3.2.0.418 which is newer and I went ahead and updated to the current version 3.3.525.

    Still didn't work on my system so I started playing around.

    This worked:
    HWI_TOTAL_OUTPUTS_		= ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI3_NUM_MIs * HWI_NUM_MI_DEVICES)
    				   + (HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_H48s * HWI_NUM_H48_DEVICES)
    				   + (HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES))
    
    and then this worked:
    HWI_TOTAL_SW_DIM 		= (HWI_TOTAL_MI_OUTPUTS + HWI_TOTAL_H48_OUTPUTS + HWI_TOTAL_RF_OUTPUTS) ;
    
    so I thought WTF! I then figured maybe because these constants that worked weren't actually used in any later declarations so I went to the first place the non working constant was used and changed it to a working constant:
    CHAR HWI_OUTPUT_NAMES[HWI_TOTAL_SW_DIM ][18]=
    
    but that didn't break the constant now that is was actually used but I didn't give up and stepped through the code and changed where HWI_TOTAL_OUTPUTS was used one at a time and it turns out that it breaks here.
    DEFINE_TYPE     //_sHWI
    
    STRUCTURE _sHWI
    
         {
         _sHWI_Status sStatus ;
         _sHWI_Outputs sOutput[HWI_TOTAL_OUTPUTS] ;//
      }
    
    if I change that to a constant declared with out a constant used with a math operation it works but if I use a constant declared using a constant and a math operation it doesn't.
    This works:
    TEST_CONSTANT 			= 40 ;
    _sHWI_Outputs sOutput[TEST_CONSTANT] ;
    
    This works:
    TEST_CONSTANT 			= (10 * 40) ;
    _sHWI_Outputs sOutput[TEST_CONSTANT] ;
    
    This doesn't:
    HWI_SOME_DUMB_NUM		= 20 ;
    TEST_CONSTANT 			= (HWI_SOME_DUMB_NUM * 40) ;
    _sHWI_Outputs sOutput[TEST_CONSTANT] ;
    

    Using HWI_TOTAL_OUTPUTS everywhere else in the code works fine but not in the structure "type" declarations. This is an old issue that I gave up on long ago so it doesn't bother me.
    HWI_TOTAL_MI_OUTPUTS		= ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI3_NUM_MIs * HWI_NUM_MI_DEVICES)) ;
    HWI_TOTAL_H48_OUTPUTS		= ((HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_H48s * HWI_NUM_H48_DEVICES)) ;
    HWI_TOTAL_RF_OUTPUTS		= ((HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ;
    
    HWI_TOTAL_OUTPUTS 		= (HWI_TOTAL_MI_OUTPUTS + HWI_TOTAL_H48_OUTPUTS + HWI_TOTAL_RF_OUTPUTS) ;
    
    like:
    if(sHWI_UI[iUI_Indx].nSelOut && sHWI_UI[iUI_Indx].nSelOut <= HWI_TOTAL_OUTPUTS)
    
Sign In or Register to comment.