Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #24772

Re: regarding header files

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: regarding header files
Date 2012-08-23 14:10 -0400
Organization A noiseless patient Spider
Message-ID <503671FF.3020400@verizon.net> (permalink)
References <dba0d348-1f6a-4570-9bc1-67dc97f081c2@googlegroups.com>

Show all headers | View raw


On 08/23/2012 01:43 PM, Varun Tewari wrote:
> Hello people,
> Hope you are all doing good.
> 
> I was eager to know, if there's a way to tell gcc to display the full path of header file that's getting included while compiling a code.
> I mean, suppose we are building a relatively big codebase, and you hitting multiple declaration error. U are able to figure out which files are causing this, but if you want to figure how these files are getting included in your code, even tough you have been careful enough to ensure such things doesn't happen, still?

If you use the -E option, gcc will create a pre-processed file
containing #line directives indicating where each section of
pre-processed code came from. Tracing backwards from the point where the
problem occurred, you can determine precisely how it got #included.


However, in my recent experience, I haven't found that necessary - gcc
usually includes the needed information in the warning message itself.
This may be a side-effect of one of the warning options I have turned on
- I normally use:-std=c99 -pedantic -Wall -Wpointer-arith -Wcast-align
-Wstrict-prototypes -Wmissing-prototypes.

Here's an example:

In file included from
/MODAPSint/SDPToolkit/SDPTK5.2.16v1.00_f90/include/CUC/odldef.h:462,
                 from
/MODAPSint/SDPToolkit/SDPTK5.2.16v1.00_f90/include/PGS_MET_Prototypes.h:32,
                 from
/MODAPSint/SDPToolkit/SDPTK5.2.16v1.00_f90/include/PGS_MET.h:619,
                 from /L1A/COMMON/MAPI/h/mapi.h:57,
                 from GEO_product.h:96,
                 from GEO_parameters.h:5,
                 from GEO_earth.h:106,
                 from GEO_write_input_metadata.c:2:
/MODAPSint/SDPToolkit/SDPTK5.2.16v1.00_f90/include/CUC/odldef_prototypes.h:36:
warning: function declaration isn’t a prototype

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

regarding header files Varun Tewari <tewari.varun@gmail.com> - 2012-08-23 10:43 -0700
  Re: regarding header files Les Cargill <lcargill99@comcast.com> - 2012-08-23 12:50 -0500
    Re: regarding header files Varun Tewari <tewari.varun@gmail.com> - 2012-08-27 09:44 -0700
  Re: regarding header files James Kuyper <jameskuyper@verizon.net> - 2012-08-23 14:10 -0400
    Re: regarding header files Varun Tewari <tewari.varun@gmail.com> - 2012-08-25 06:32 -0700
  Re: regarding header files Lucas Pesenti <lucas-pesenti@hotmail.fr> - 2012-08-28 17:58 +0200

csiph-web