07-21-2019 09:55 AM
Hi all,
I am trying to transfer an old program from CVI 2010 to 2017 and during the process , i encounter this problem.
The program has two .h files :
+ In the first h file , I have below struct:
struct Serie { int product; unsigned int prod; char type[50]; char setup[50]; struct Date date; struct Time time; double humidity; double temperature; int coilsInSerie; int coilsMeasured; int coilsRejected; int coilsGood; int notInBandgroup; struct Parameter value[PARAM_NUM]; };
+In the second .h file , I include the first .h file and want to use Serie struct as an element of below struct:
struct Setup
{
int ableToMeasure[PARAM_NUM];
int switchPort;
struct Clamp clamp[2];
struct Serie serie[2];
};
"SETUP.H"(45,21)error: array has incomplete element type 'struct Serie'
"SETUP.H"(45,10) note: forward declaration of 'struct Serie'
I now know I have to forward declare struct Serie , just i don't know how.
Somehow , the program complied fine in CVI 2010 , any help is appreciated though.
07-30-2019 02:43 PM
Hi john_pe,
Can you post your whole code, or at least a simple reproducing case? This would be helpful for testing purposes to get to the bottom of this.
Best,
11-15-2022 08:14 AM
Hi,
I also have this problem.
"array has incomplete element type" is done by the compilator on CVI 2017, and didn't on CVI 2009.
this code is in a file.h
extern struct S_KeyText g_message[];
Thanks for your help.
11-15-2022 10:16 AM
That's C99 syntax.
Probably change it to:
extern struct S_KeyText *g_message;