By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

How can I set up the path where the compiler(g++) will search forthe header files

P: n/a
Hello,
I have the following problem. I try to compile a .cpp file with an
include statement. But the included header file is in another dir. How
can I tell my compiler where to search for it.
This is the c++ compiler which I use:

g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)

thanks,
Peter
Dec 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Peter Rothenbuecher wrote:
Hello,
I have the following problem. I try to compile a .cpp file with an
include statement. But the included header file is in another dir. How
can I tell my compiler where to search for it.
This is the c++ compiler which I use:

g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)

thanks,
Peter


This question is off-topic here, since it is compiler-specific. You
should consult the compiler documentation (or just type "g++ --help").

Cheers! --M

Dec 13 '05 #2

P: n/a
Peter Rothenbuecher wrote:
Hello,
I have the following problem. I try to compile a .cpp file with an
include statement. But the included header file is in another dir. How
can I tell my compiler where to search for it.
This is the c++ compiler which I use:

g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)


'man gcc' or 'man g++'

F'up to gnu.gcc.help
--
Stefan Naewe
naewe.s_AT_atlas_DOT_de
Dec 13 '05 #3

P: n/a

mlimber wrote in message
<11*********************@z14g2000cwz.googlegroups. com>...
Peter Rothenbuecher wrote:
Hello,
I have the following problem. I try to compile a .cpp file with an
include statement. But the included header file is in another dir. How
can I tell my compiler where to search for it.

This is the c++ compiler which I use:
g++ -v
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)
thanks,
Peter


This question is off-topic here, since it is compiler-specific. You
should consult the compiler documentation (or just type "g++ --help").
Cheers! --M


An somewhat OnTopic answer could be:
In the #include, give the full path relative to the current directory.
#include "../../../myspecial/dingdong.h"
or, a full path.
#include "/home/me/mydev/myspecial/dingdong.h"

But, knowing the '-I'(upper-case i) and '-L' switches in GCC is a good thing.

--
Bob R
POVrookie
Dec 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.