Using Header File

Hi All,

I have bunch of header files , which include each other .
Example :
file1.h
will have #include<temp/file2.h>
file2.h
will have #include<temp/file3.h>
file3.h
will have #include<temp/someFile.h>

In this they all have this "temp" folder in relative directory. Therefore, i am confused about how can i use them with g++ compiler.
Can you please help me.
Assuming the file structure looks like this:

├───project_dir <dir>
│   │   main.cpp
│   │
│   └───temp <dir>
│           file1.h
│           file2.h
│           file3.h
│           someFile.h


Within <project_dir> on the command line, type
g++ -I. main.cpp -o main


The
-I.
lets the compiler look for <include/path> from the current directory (.)
Last edited on
Do you really want to be naming a directory that contains important source code, "temp"? Normally, the convention is that if a directory is named "tmp" or "temp", it will contain only temporary files that can safely be deleted when an application finishes.
Thanks @Ganado .. It worked

@MikeyBoy
Thanks for reply. Actually i have some external library which have header files in that FORMAT, not exactly temp.
Topic archived. No new replies allowed.