0

Hi everybody, I have a problem in include path. i want to keep my all header file in folder named myInclude and include it like #include<myInclude/header.h>, Is there any possible way to do this, if there is than please tell me the step.
thanks in advance...........

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by rajenpandit
0

Hey there,

If you're doing this for C, you can just use quotes instead of the angle brackets, like

#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:

#!/bin/bash

. /home/yourdir/myIncludes/header.sh

code
code
code

and you'll be all set :)

, Mike

0

> #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 gcc -I/home/yourdir prog.c where /home/yourdir is the place where the myInclude directory exists, containing the header.h file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.