c++ - including .h file from a different application/directory -


I have some .h files (on Linux)

  source / server / connect . Source / Server / Message ...  

I am developing another application for which two .h files are required but in a separate directory

  source / ap 2 / ..  

How can I include Connected H files in AP2 application, considering that I am using ultraviolet and everyone working on the application It has its own copy, so adding a complete path to the library included in it is a good No idea, but I'm not sure.

EDIT: I use a proprietary build mechanism to make the code, so GCC will not be able to specify options directly.

You have a relative path for the #include files:

  #include "../server/ Connect.h " 

or you can add a flag to tell the compiler to look at other directories. You can use -i ../server/code for GCC; For Visual C ++ you can use / I "..// server" ; Other compilers, I am sure, have their own flag for this purpose.

I think the second is better in most cases, because this allows you to transfer your projects, whereas only you need to include it in the path one place (makefile or property sheets) .


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -