Operating System - HP-UX
1753670 Members
5506 Online
108799 Solutions
New Discussion

error 1523: Too many initializers.

 
edu martin lucas
New Member

error 1523: Too many initializers.

Hi, i can´t understand the problem in my code...

Could you help me with this error??

char *descripcion_errorcd_2 [] = {
"",
"",
"",
"Deal successfully logged in STAR ",
"Deal exceeded clients credit line in STAR ",
"ERROR trading with STAR ", /* 5 */
"WARNING: Deal logged in STAR. Not all blocking operations cancelled ",

/* otros mensajes para IFOPE y algunas del LOG*/

"IFJ73100 Error al descontratar ope_nu es 0 ",
"IFJ73100 Error al descontratar: %d ",
"Operacion Rechazada",
"IFJ73100 Error rellenando estructuras para contratar", /* 10 */
"IFJ73100 Error en la contratacion de la operacion: %ld ",
"IFJ73100 Error en consulta de estado del mercado", // "Error consulting currency market"
"IFJ73100 Mercado deshabilitado", // "Currency Market disabled"
"IFJ73100 Error al liberar la operacion: %ld , %ld",
"Operacion liberada en STAR", /* 15 */
"IFJ73100 Error en la contratacion del plazo: %ld ",
"IFJ73100 Error en la contratacion spot: %ld ",
"IFJ73100 Error de BBDD en la contratacion",
"IFJ73100 Error al confirmar la operacion: %ld ",
"Operacion confirmada en STAR",/*20*/
"Error en la obtencion del producto",
"Error al realizar ROLLBACK/COMMIT en la confirmación",
"Error al realizar ROLLBACK/COMMIT en la liberación",
"",
"Operacion confirmada en Excedido", /*25*/
"Operacion liberada en Excedido"
};
8 REPLIES 8
Jose Mosquera
Honored Contributor

Re: error 1523: Too many initializers.

Hola Edu,

Please check this, please find Error 1523:
http://docs.hp.com/en/5921/errors.html

Rgds
mvpel
Trusted Contributor

Re: error 1523: Too many initializers.

The short answer is that you're trying to use an initializer on an unallocated array. Replace:

*descripcion_errorcd_2[]

with:

*descripcion_errorcd_2[27]

And it should work for you.
edu martin lucas
New Member

Re: error 1523: Too many initializers.

Thx all for the anwsers. I tried what you posted but it didn´t work neither. Finally, i change my array like that and it works!! :

char *descripcion_errorcd_2 [] = {
"",
"",
"",
"Deal successfully logged in STAR ",
"Deal exceeded clients credit line in STAR ",
"ERROR trading with STAR ", /* 5 */
"WARNING: Deal logged in STAR. Not all blocking operations cancelled ",

/* otros mensajes para IFOPE y algunas del LOG*/

"IFJ73100 Error al descontratar ope_nu es 0 ",
"IFJ73100 Error al descontratar: %d ",
"Operacion Rechazada",
"IFJ73100 Error rellenando estructuras para contratar", /* 10 */
"IFJ73100 Error en la contratacion de la operacion: %ld ",
"IFJ73100 Error en consulta de estado del mercado", // "Error consulting currency market"
"IFJ73100 Mercado deshabilitado", // "Currency Market disabled"
"IFJ73100 Error al liberar la operacion: %ld , %ld",
"Operacion liberada en STAR", /* 15 */
"IFJ73100 Error en la contratacion del plazo: %ld ",
"IFJ73100 Error en la contratacion spot: %ld ",
"IFJ73100 Error de BBDD en la contratacion",
"IFJ73100 Error al confirmar la operacion: %ld ",
"Operacion confirmada en STAR",/*20*/
"Error en la obtencion del producto",
"Error al realizar ROLLBACK/COMMIT en la confirmación",
"Error al realizar ROLLBACK/COMMIT en la liberación",
""
};

char *descripcion_error_excedido [] = {
"Operacion confirmada en Excedido",
"Operacion liberada en Excedido"
};

P.S.: i tried with that too:
char *descripcion_errorcd_2 [26]

Steven Schweda
Honored Contributor

Re: error 1523: Too many initializers.

> The short answer is [...]

Ok, but what's the _right_ answer?

> [...] you're trying to use an initializer
> on an unallocated array.

Really? I didn't think that C was that lame.

> Hi, i can't understand the problem in my
> code...

Neither can I, but with my weak psychic
powers, I can't be sure what "my code" really
is, nor can I see which compiler you're
using, or how. I pasted your posted array
declaration into an example program, and it
seems to work for me on some non-HP-UX
systems which I have up at the moment:

alp $ type 1471496.c
#include

int main( int argc, char ** argv)
{
char *descripcion_errorcd_2 [] = {
"",
"",
[... all of that stuff...]
"Operacion confirmada en Excedido", /*25*/
"Operacion liberada en Excedido"
};

printf( " err[ 15]: >%s<.\n", descripcion_errorcd_2[ 15]);

return 0;
}


alp $ cc /version
HP C V7.3-009 on OpenVMS Alpha V8.3

alp $ cc 1471496.c
alp $ link 1471496
alp $ run 1471496
err[ 15]: >Operacion liberada en STAR<.


ra> uname -a
SunOS ra 5.10 Generic_141444-09 sun4u sparc SUNW,UltraSPARC-IIi-cEngine

ra> cc -V
cc: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
[...]

ra> gcc --version
gcc (GCC) 3.4.6
[...]

ra> cc -o 1471496 1471496.c
ra> ./1471496
err[ 15]: >Operacion liberada en STAR<.

ra> gcc -o 1471496g 1471496.c
ra> ./1471496g
err[ 15]: >Operacion liberada en STAR<.

I don't have a genuine HP C compiler, but, so
far as I can see, everybody loves _my_
program.

If you attach an actual test case next time,
then perhaps one of us non-psychics could
figure out what's happening at your end.
edu martin lucas
New Member

Re: error 1523: Too many initializers.

I´m sorry about my posts. You are right, the compiler that i have been used is a HP C/HP-UX compiler (i can´t see the exact version because i use an rare aplication to compile).

Regards and thx.

P.S.:
> [...] you're trying to use an initializer
> on an unallocated array.

I tried other posibilities because the first array declaration didn´t work and i thought this declaration should work.
Steven Schweda
Honored Contributor

Re: error 1523: Too many initializers.

> I'm sorry about my posts.

So, fix the problem(s).

> You are right, [...]

Who's right? About what?

> [...] the compiler that i have been used is
> a HP C/HP-UX compiler [...]

Within rather broad limits, C is C. Three
different compilers all liked _my_ example
program. I still haven't seen _your_ example
program.

> [...] (i can't see the exact version
> because i use an rare aplication to
> compile).

So, I don't really know what you're trying to
compile, and I don't really know how you're
trying to compile it. How much help were you
expecting to get?
Dennis Handly
Acclaimed Contributor

Re: error 1523: Too many initializers.

>I change my array like that and it works!

You might want to also explain what you did. With all those lines it's hard to see you split the array.

One way to get 1523 is to declare the array with a smaller dimension first:
char *descripcion_errorcd_2[25];
char *descripcion_errorcd_2[] = { ...

Create a .i file and scan for that variable: -E -.i
Or insert the actual dimension (or just use 1000) and see if the compiler will tell you the location of the conflicting shorter declaration.

> can't see the exact version

Just use "cc -V".

>mvpel: The short answer is that you're trying to use an initializer on an unallocated array.

As Steven said, that's not how C works. C allows programmers to leave out the dimension and the compiler will calculate it.

So the real short answer is to look for conflicts in the declaration of the variable.
Dennis Handly
Acclaimed Contributor

Re: error 1523: Too many initializers.

>ME: One way to get 1523 is to declare the array with a smaller dimension first:
char *descripcion_errorcd_2[25];
char *descripcion_errorcd_2[] = { ...

If you do this, the error message points to the line with the index larger the the dimension:
error #2146: too many initializer values
"Operacion confirmada en Excedido", /*25*/