C++ Question How to link 1 .h file in 2 different projet ?

Woodylepic

New member
Joined
Dec 29, 2009
Messages
71
Reaction score
0
Points
0
I was compiling 2 projet in same programme, and both projet get the same .h file. it is possible like shuttle atlantis to get only 1 h.file that acomodate the two programme.:rolleyes:?
 
Last edited:
Yes. It is possible. You can add an existing .h file from one project to another project.
 
Yes but how to set the projet to partage the h file whit the 2 projets instead of having 2 identical h file in both projet ?:huh:
 
Either by dragging file to Solution Explorer or adding an existing item from menu.

By adding files to project you don't copy any files there, but only reference them by name by providing path to them.
 
Add the directory of the .h files to the "Additional Include Directories" list the project settings (somewhere under compiler settings I think).
 
Add the directory of the .h files to the "Additional Include Directories" list the project settings (somewhere under compiler settings I think).
Project properties... -> Configuration Properties -> C/C++ -> General

It's good, when you plan to use more than one header file from another project, and header files in your project have other names than those in another, as you don't use relative paths then.
 
Back
Top