943,796 Members | Top Members by Rank

Ad:
Jun 23rd, 2009
0

Change standard include path

Expand Post »
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...........
Similar Threads
Reputation Points: 9
Solved Threads: 1
Newbie Poster
rajenpandit is offline Offline
13 posts
since Aug 2008
Jun 25th, 2009
0

Re: Change standard include path

Use unix profile file
Reputation Points: 10
Solved Threads: 6
Light Poster
msvinaykumar is offline Offline
48 posts
since May 2006
Jun 28th, 2009
0

Re: Change standard include path

Hey there,

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

Shell Scripting Syntax (Toggle Plain Text)
  1. #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)
  1. #!/bin/bash
  2.  
  3. . /home/yourdir/myIncludes/header.sh
  4.  
  5. code
  6. code
  7. code

and you'll be all set

, Mike
Reputation Points: 102
Solved Threads: 47
Posting Whiz
eggi is offline Offline
399 posts
since Oct 2007
Jun 28th, 2009
0

Re: Change standard include path

> #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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jul 6th, 2009
0

Re: Change standard include path

Thank u salem. its working...........
Reputation Points: 9
Solved Threads: 1
Newbie Poster
rajenpandit is offline Offline
13 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: modifying xml files using sed
Next Thread in Shell Scripting Forum Timeline: *nix shell script symbols





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC