LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

invalid use of struct

I am getting an "Invalid Use of Struct" on my "instrument" text.

 

 

typedef struct 
{
device dev;
char *name;
unsigned short int channels;
} instrument;

 

 

typedef struct 
{
	device dev;
	char *name;
	unsigned short int channels;
} instrument;

 

 

 

And device is created in an includ file and contains teh following

 

typedef int device; enum
{
	E3648A = 1,
	AG66321B = 0,
	AG66321D = 0,	//Same functions as 66321B
	PST3202 = 2								   
}

 

 

0 Kudos
Message 1 of 2
(3,216 Views)

 

 

 

typedef enum

{
E3648A = 1,
AG66321B = 0,
AG66321D = 0,
PST3202 = 2
} device;
typedef struct 
{
device dev;
char *name;
unsigned short int channels;
} instrument;

 

Hi,

 

I got your code and re-arranged it a little.

The following code did not generate any compile errors on CVI 6.0 which is the only version I have on this machine.

 

Make sure the device enum is defined before the compiler works on instrument struct.

Otherwise it cannot understand what a "device" is.

 

 

typedef enum
{
  E3648A = 1,
  AG66321B = 0,
  AG66321D = 0,
  PST3202 = 2
} device;

typedef struct
{
  device dev;
  char *name;
  unsigned short int channels;
} instrument;

 

 

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 2
(3,203 Views)