Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


Search this Thread
Old 05-14-2012, 11:02 PM   #1
Registered: Feb 2009
Location: Bangalore
Posts: 61

Rep: Reputation: 15
Header file inclusion

I have huge C code base. There is a header file which is included in multiple C files. How do I know where is the header file included for the first time?
Old 05-15-2012, 01:00 AM   #2
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,727

Rep: Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262
it has no meaning, it depends on the target you want to create. But you can remove/rename that include file and the first error message complaining about it is the answer.
Old 05-15-2012, 08:38 AM   #3
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,377

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
Some languages "know" whether or not a particular header file is included; others do not.

In many "C" header files you will therefore see this: (e.g. in the imaginary file, xyzzy.h):
   ... included stuff goes here ...
Notice that, if the symbol is not yet defined, the block will be included, and within that block the symbol (which is arbitrarily but consistently named, and which serves no other purpose...) is defined. Thereafter, no matter how many subsequent times we may see #include "xyzzy.h", and even though the file will be included each time, its contents will be effectively ignored in every case but the first.

It is a cumbersome mechanism, and this why other languages provide a require or use construct (your keyword may vary...) with a more powerful semantics.

Last edited by sundialsvcs; 05-15-2012 at 08:40 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with inclusion of qt header files namus123 Linux - Desktop 3 06-04-2010 03:06 PM
problem with inclusion of qt header files namus123 Linux - Mobile 2 06-04-2010 05:34 AM
automatic header inclusion rajorshi Programming 2 11-02-2003 02:29 PM

All times are GMT -5. The time now is 07:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration