Обсуждение: Trouble including "pg_type.h"

Поиск
Список
Период
Сортировка

Trouble including "pg_type.h"

От
bradg
Дата:
I was hoping someone could point me in the right direction. After three days
of searching and reading and fooling around, I'm out of options.

I get compiler errors when I include "pg_type.h" in my project. The error
appears to happen around the line:
*CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO*

And the errors include:
*Parse Issue: Expected ')'
Parse Issue: Expected ';' after top level declarator
Parse Issue: Unknown type name 'FormData_pg_type'*

When I just import "libpq-fe.h" there are no compiler problems. And I am
able to successfully send and receive data in PostgreSQL.

The second I add "pg_type.h" I get problems. And I would like to include
"pg_type.h" so I can use the datatype oids in my program instead of
hard-coding the values.

For what it's worth. I'm programming in OS X 10.7 with Xcode 4.1 using the
PostgreSQL files from the EnterpriseDB one-click installer.

Thanks in advance for any insight.

Brad

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Trouble-including-pg-type-h-tp4746983p4746983.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

Re: Trouble including "pg_type.h"

От
Tom Lane
Дата:
bradg <bg4all@me.com> writes:
> I get compiler errors when I include "pg_type.h" in my project.

By and large you can't do that without including postgres.h or
postgres_fe.h first.

            regards, tom lane

Re: Trouble including "pg_type.h"

От
bradg
Дата:
Thanks for the reply.

When I include either "postgres.h" or "postgres_fe.h" I get the following
compiler errors with file c.h:

Semantic Issue: Typedef redefinition with different types ('unsigned long'
vs 'uint64_t' (aka 'unsigned long long')) in
/Library/PostgreSQL/9.0/include/postgresql/server/c.h

Semantic Issue: Typedef redefinition with different types ('size_t' (aka
'unsigned long') vs 'long') in
/Library/PostgreSQL/9.0/include/postgresql/server/c.h

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Trouble-including-pg-type-h-tp4746983p4747906.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

Re: Trouble including "pg_type.h"

От
bradg
Дата:
Just wondering if I should change the header file.

Like comment out the lines or something...

But I'm not sure what effect that would have.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Trouble-including-pg-type-h-tp4746983p4750844.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

Re: Trouble including "pg_type.h"

От
Merlin Moncure
Дата:
On Tue, Aug 30, 2011 at 12:03 PM, bradg <bg4all@me.com> wrote:
> Just wondering if I should change the header file.
>
> Like comment out the lines or something...
>
> But I'm not sure what effect that would have.

It would have the effect of breaking the header file.  Try cribbing
from the contrib folder as an example of how to include backend
headers.

merlin