Re: How to include the header files effectively

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: How to include the header files effectively
Date: 2019-04-12 02:22:56
Message-ID: 20190412022256.GA32225@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2019-04-12 02:24:28 Re: Should we add GUCs to allow partition pruning to be disabled?
Previous Message Tom Lane 2019-04-12 02:21:14 Re: How to include the header files effectively