LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Redundant assignments of resource ID's in CVI generated multiple #include .h files

I have multiple .uir files.  When I compile them the compiler will complain that there are duplicate resouce ID's because of the multiple .h files that are created for the respective .c code files look something like:
 
uir1.h -> Generates say UIR1_RESOURCE_PANEL     1
uir2.h -> Generates        UIR1_RESOURCE_PANEL     1
                                        UIR2_RESOURCE_PANEL     2
                                        UIR3_RESOURCE_PANEL     3
uir3.h -> Generates        UIR4_RESOURCE_PANEL     1
                                        UIR5_RESOURCE_PANEL     2
                                        UIR6_RESOURCE_PANEL     3
 
Now because lets say uir3.c has an #include "uir2.h" the compiler will complain that there are duplicate resource ID declaration 1, 2, 3.  Now if you change the include file for uir3.h to look like:
 
uir3.h ->                          UIR7_RESOURCE_PANEL     4
                                        UIR8_RESOURCE_PANEL    5
                                        UIR9_RESOURCE_PANEL    6
 
Now the compiler is happy.  However at runtime guess what.  When the executable goes to find lets say UIR4_RESOURCE_PANEL a run time error will occur telling you that the resource ID could not be found in uir3.uir file which I suppose makes sense.  So outside of putting all my panels in one giant .uir (I have 13) including menus how does one get around this little gotcha?
0 Kudos
Message 1 of 3
(2,990 Views)

In a project with multiple .uirs, it is a simple matter to ensure that the identifier prefix (ie the constant name of each panel - the first item in the Edit Panel window) is different between all panels. This avoids any multiple definition problems.

JR

0 Kudos
Message 2 of 3
(2,978 Views)
Just noticed: you say you edited the .h file generated from the .uir file - note that NI state that these files must not be hand edited. It would lead to confusion over which controls are really where...
 
JR
0 Kudos
Message 3 of 3
(2,973 Views)