PDA

View Full Version : [SOLVED] can u save c++ header to a diff location



AceDip
October 21st, 2008, 12:16 PM
I dont like the tedious task of everytime saving your c++ header files in /usr/include/c++/4.2
instead i would want to save them in the same folder as with my other c++ programs.

CptPicard
October 21st, 2008, 12:42 PM
Why do you need to do that?

Just #include "yourheader.h" and it's looked for in the current directory...

dwhitney67
October 21st, 2008, 01:01 PM
I dont like the tedious task of everytime saving your c++ header files in /usr/include/c++/4.2
...
:shock: WTF?

Save your header file within your current working directory (as CptPicard noted). If you need to store it elsewhere, then specify the location using the -I option when you compile. For example:

Headers are in /home/programbo/headers. Code in /home/programbo/code.

compile file1.cpp using:

g++ -I/home/programbo/headers file1.cpp -o myprog

AceDip
October 21st, 2008, 01:28 PM
thanks man