PDA

View Full Version : Include header files in gcc/g++



Binny88
December 28th, 2009, 03:47 AM
Hello guys

I want to know the options to include certain header files in gcc/g++ or to be more specific the path to these header files. The gcc manual is too extensive so I had to ignore it.

Thanks in advance
Binny

Bachstelze
December 28th, 2009, 03:50 AM
cc -I/path/to/dir -o foo foo.c

falconindy
December 28th, 2009, 03:53 AM
Hello guys

I want to know the options to include certain header files in gcc/g++ or to be more specific the path to these header files. The gcc manual is too extensive so I had to ignore it.

Thanks in advance
Binny
You can press '/' and search for terms in man pages.

Welcome to Linux. If something seems too difficult, there's probably an easier way to accomplish the task.

Bachstelze
December 28th, 2009, 04:07 AM
You can press '/' and search for terms in man pages.

Welcome to Linux. If something seems too difficult, there's probably an easier way to accomplish the task.

I'm not sure that would have helped much in this case...

monkeyking
December 28th, 2009, 01:58 PM
I'm not sure that would have helped much in this case...
I agree that the man pages can be quite incomprehensible :)
I wouldn't know what to search for in this case.

But a quick google would have solved you problem ;)

OVERPOWER8
December 28th, 2009, 04:31 PM
I think you need to place all the header files in the same folder where is the c file you are going to compile.

And to include header files, just write:

#include "Header.h"

or:
#include "full/path/to/header.h"

dwhitney67
December 28th, 2009, 04:56 PM
I think you need to place all the header files in the same folder where is the c file you are going to compile.

And to include header files, just write:

#include "Header.h"

or:
#include "full/path/to/header.h"
Wrong. Please read Bachstelze's post.