Recent

Author Topic: Don't understand compiler error.  (Read 249 times)

JLWest

  • Hero Member
  • *****
  • Posts: 987
Don't understand compiler error.
« on: August 21, 2020, 10:44:03 pm »
I get the following error on the code below. This same code is in two programs. One program compiles just fine and the the other program gives me this error.
 
apicollections.pas(576,57) Error: Expected another 1 array elements

Code: Pascal  [Select][+][-]
  1.  TDays = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
  2.  
  3. TDayNames : array [TDays] of String =
  4.                        ('Sunday',    'Monday',  'Tuesday', 'Wednesday',
  5.                          'Thursday', 'Friday',    'Saturday' );                    
   
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

TRon

  • Hero Member
  • *****
  • Posts: 536
Re: Don't understand compiler error.
« Reply #1 on: August 21, 2020, 10:56:49 pm »
@JLWest,
It is rather impossible to tell what's wrong without seeing the actual code that produces that error.

however:
Quote
apicollections.pas(576,57) Error: Expected another 1 array elements
generally indicates that the number of items in the TDayNames is one item short.

Did you perhaps mismatched or mistyped a "," somewhere ?

Also note that TDayNames is actually a variable, and that it is a bit strange to prefix that with a T (as that is usually used for type declarations).

JLWest

  • Hero Member
  • *****
  • Posts: 987
Re: Don't understand compiler error.
« Reply #2 on: August 21, 2020, 10:59:55 pm »
@TRon
XCheck
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018