Operating System - HP-UX
1748176 Members
4224 Online
108758 Solutions
New Discussion

error 1523: Too many initializers

 
Blake Mortensen
Occasional Contributor

error 1523: Too many initializers

I'm receiving this error on code that has been recompiled successfully previously. Some libraries have been change (not directly related to the code receiving the error. The code has not changed. The compile command-line is:

/usr/bin/c89 -D__unix -D__hpux
-I/usr/local/geostan/common/geostan
-I/inf821ud4/incl/esql -w -c GeoRcdDb.c

The code snippet looks like:

GeoRcdMethods GeoRcdDbMethods= {newDb,deleteDb, InitDb,NoAdrDtl,
MinRcdSizeDb,ImportDb, ExportDb,ExportInputDb,
DumpDb,
AdrLineDb,LstLineDb, UpdAdrLineDb,UpdLstLineDb, cs_cust_idDb,cs_cust_idSizDb, cs_hhold_idDb,cs_hhold_idSizDb,
AddressDb,AddressSizDb,
CityDb,CitySizDb,
StateDb,StateSizDb,
ZipDb,ZipSizDb,
UpdAddressDb,UpdAddressSizDb,
UpdCityDb,UpdCitySizDb,
UpdStateDb,UpdStateSizDb,
UpdZipDb,UpdZipSizDb,
UpdLatitudeDb,UpdLatitudeSizDb,
UpdLongitudeDb,UpdLongitudeSizDb,
UpdBlockIdDb,UpdBlockIdSizDb,
SetWhereDb,GetNextRecordDb,
UpdateRecordDb
};

Thanks in advance for any help.

Blake Mortensen
mortensen.blake@amstr.com
1 REPLY 1
Mike Stroyan
Honored Contributor

Re: error 1523: Too many initializers

There was an old error with that appearing when using "#pragma HP_ALIGN ". That was corrected in release A.09.27. Other initializer counting errors have been related to long long type or wide character strings. It would be helpful to know the version of you compiler and the exact definition of your GeoRcdMethods type.

Have a look at the output of "c89 -E" to see if some cpp macro has changed the meaning of that declaration or the definition of GeoRcdMethods.

From /opt/ansic/lib/nls/msg/C/c.msgs-

Error 1523
===============================================================================

Too many initializers.

An initializer list contains more initializers than elements in the object
being initialized.

int arr[3] = {0, 1, 2, 3};
main()
{
static struct {int i; char c;} s = {4,'e',55};
}

Either increase the size of the object being initialized or decrease the
number of initializers. For example,

int arr[4] = {0, 1, 2, 3};
or
int arr[3] = {0, 1, 2};
and
static struct {int i; char c; int j;} s = {4,'e',55};
or
static struct {int i; char c;} s = {4,'e'};