Re: How to include the header files effectively - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: How to include the header files effectively
Date
Msg-id 20190412022256.GA32225@alvherre.pgsql
Whole thread Raw
In response to How to include the header files effectively  (Andy Fan <zhihui.fan1213@gmail.com>)
Responses Re: How to include the header files effectively
List pgsql-hackers
On 2019-Apr-12, Andy Fan wrote:

> for example,  when I want the LOCKTAG in .c file,   which is defined in
> "storage/lock.h".  then I wrote the code like this:
> 
> #include "storage/lock.h"
> ...
> 
> /../../../src/include/storage/lockdefs.h:50:2: error: unknown type name
>       'TransactionId'
>         TransactionId xid;                      /* xid of holder of AccessExclusiveLock */

What are you trying to do?  Your .c file must include "postgres.h"
before any other header file.  There should be no other dependencies.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to include the header files effectively
Next
From: Justin Pryzby
Date:
Subject: Re: Should we add GUCs to allow partition pruning to be disabled?