LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Forward declaration of struct

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.

 

 

 

 

 

 

0 Kudos
Message 1 of 4
(2,676 Views)

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,

Claire C.
AppSW Staff Product Support Engineer
National Instruments
CLD|CTD
0 Kudos
Message 2 of 4
(2,547 Views)

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.

0 Kudos
Message 3 of 4
(1,359 Views)

That's C99 syntax.

Probably change it to:

extern struct S_KeyText *g_message;

0 Kudos
Message 4 of 4
(1,341 Views)