Operating System - HP-UX
1820644 Members
1739 Online
109626 Solutions
New Discussion юеВ

How to have the include -I in cc to include more than one direcory?

 
SOLVED
Go to solution
Ai Jun Zhang
Occasional Contributor

How to have the include -I in cc to include more than one direcory?

Hi!

I have some header files in the current directory and some header files in another directory, e.g. /home/Application/Include/,
I do not know how to specify in the -I. when I use cc to have two directories to be the include dirs to be searched for.

Is this correct to compile my c files which need two include dirs - one is the current dir and one is the /home/Application/Include/?

cc -I. /home/Application/Include/ *.c

Please let me know.
Thanks.
Aijun.
2 REPLIES 2
RikTytgat
Honored Contributor

Re: How to have the include -I in cc to include more than one direcory?

Hi,

Too specify different directories fot the linker to search in, use '-Ldirectory' different times.

So in your case:
-L. -L/home/Application/Include

The lower caps 'l' is to specify the libraries. The same rule is true here. If you need more than one librarie, use multiple '-l' switches.

This should solve your problem.

Bye,
Rik
RikTytgat
Honored Contributor
Solution

Re: How to have the include -I in cc to include more than one direcory?

Oops,

I misunderstood your question.

To specify more than 1 include directory, the same principle works too.

-I/include/dir/one -I/include/dir/two

Bye,
Rik.