I am programming for a big project, so I cooperate with others. To make the directory easily managed, my directory is like below:
project:
--include (header files from others supplied for me)
--lib (libraries from others supplied for me)
--L3_CVS (this folder include all my files)
-- Makefile
-- sourceFile (all my source files here)
-- include_private(all header files used only by myself)
-- appl (all my C files here)
if I want to include a .h file in my .c file, do I need to write in .c file " #include "../include-private/XX.h" "??? what if i just write in .c " include "XX.h" "?
Because I need to use the .h files in "include folder" which others supply for me, how could I write in my .c files to include these .h files??
my makefile is below:
how to include .h document in makefile
thank you for your help!!!
Depends on the compiler, but typically, you'll want to add the following line:
CFLAGS
is a variable that make uses to add command-line options for the C compiler ("C" flags). For C++, you need to useCXXFLAGS
. If I'm using C and C++ in the same project, I'll typically create a variable calledINCLUDES
, and use it like this: