From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

error: member reference base type 'int' is not a structure or union

Solved!
Go to solution

I define a structure

typedef struct
{
char g_sUDP_HostAddress[MAX_ADDRESS_LEN];
char g_sUDP_ClientAddress[MAX_ADDRESS_LEN];
int g_iUDP_ReadPort;
int g_iUDP_WritePort;
double g_dMaxCurrentComsumption_A;
double g_dOperatingVoltage_V;
int g_iPSU1TestWaitTime;
double g_dTestVoltage_33V;
double g_dTestVoltage_16V;
int g_iRLY3152TestWaitTime;
int g_iRLY2114TestWaitTime;
int g_iRLY2662TestWaitTime;
double g_dAIO1OutputVoltage_V;
double g_dAIO1InputVoltage_V;
int g_iAIO1TestWaitTime;
int g_iDIO1TestWaitTime;
int g_iAIO1LogicOutputVoltage_V;
int g_iCATALYSTTestWaitTime;

} Test_Parameter_t;

Test_Parameter_t Test_Parameter;

In another file I pass a member of the structure as an argument 

extern Test_Parameter;

SetVoltage ( Test_Parameter.g_dOperatingVoltage_V );

While compiling I get an error:

error: member reference base type 'int' is not a structure or union

 

How do I fix the problem?

 

0 Kudos
Message 1 of 3
(30,766 Views)
Solution
Accepted by topic author alon9669

Hi,

 

with

extern Test_Parameter;

you are declaring an int with name Test_Parameter and external linkage.

 

You need to add the type:

extern Test_Parameter_t Test_Parameter;

 

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 2 of 3
(30,759 Views)

Thx!

0 Kudos
Message 3 of 3
(30,743 Views)