From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, 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: 

one shared head file ,how to use for different project and files

I have a question below:

One header file atf2_general.h located in C:\pool\l2_idrv\headers folder, and my source code located in C:\atf\l2_idrv folder( atuomatically copy my.lib, my.dll to pool folder by post-build actions batch file)

assupmtion: One project  my.prj include 4  *.c files(1.c, 2.c, 3.c,and 4.c), each *.c NEED  atf2_general.h support, i do not want to  include this head file in the begining of  each *.c file.

and this my.prj also do not want to add this head file in project ,  i try add" C:\pool\l2_idrv\headers " in Options\Enviroment\Include Paths\applied to all project

but still  failed to compile? what is best way for such problem

 

Thanks a lot!

 

0 Kudos
Message 1 of 3
(3,321 Views)

If the header file is not included in the source files you are likely to get compile errors in each line referencing objects defined in the header file!  While it's not needed to add the header file to the project,  it'mandatory to include it in every source file using its items.  The only way I see to avoid including it directly is to have it included in a general header file together with other general use defines and includes,  and include that header only in the source files.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,303 Views)
Dear, I just do the way you mentioned, Thanks gretatly. the general.h need include in each *.c file, but do not need include in *.Prj by include path setting
0 Kudos
Message 3 of 3
(3,289 Views)