| | |
Change standard include path
![]() |
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Hey there,
If you're doing this for C, you can just use quotes instead of the angle brackets, like
If you're using a shell and your includes are functions, you can put them in your .profile, as advised above or just create your header.sh file and source it at the head of all of your script like:
and you'll be all set
, Mike
If you're doing this for C, you can just use quotes instead of the angle brackets, like
Shell Scripting Syntax (Toggle Plain Text)
#include "/home/yourdir/myInclude/header.sh"
If you're using a shell and your includes are functions, you can put them in your .profile, as advised above or just create your header.sh file and source it at the head of all of your script like:
Shell Scripting Syntax (Toggle Plain Text)
#!/bin/bash . /home/yourdir/myIncludes/header.sh code code code
and you'll be all set

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
> #include "/home/yourdir/myInclude/header.sh"
Don't do this.
Absolute paths to header files are a disaster waiting to happen.
If you reorganise your workspace, or give the code to someone else, then you have to edit ALL the code just to make it compile again.
Instead, do
where /home/yourdir is the place where the myInclude directory exists, containing the header.h file.
Don't do this.
Absolute paths to header files are a disaster waiting to happen.
If you reorganise your workspace, or give the code to someone else, then you have to edit ALL the code just to make it compile again.
Instead, do
gcc -I/home/yourdir prog.c where /home/yourdir is the place where the myInclude directory exists, containing the header.h file.
![]() |
Similar Threads
- how to include path to binaries (C++)
- Set the include path (C++)
- Zend_controller (PHP)
- #include <GL/glut.h> (C)
Other Threads in the Shell Scripting Forum
- Previous Thread: modifying xml files using sed
- Next Thread: *nix shell script symbols
| Thread Tools | Search this Thread |






