Skip site navigation (1) Skip section navigation (2)

visual c++ compile error when included spi.h and trigger.h

From: "mingsoftt" <mingsoftt(at)singnet(dot)com(dot)sg>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: visual c++ compile error when included spi.h and trigger.h
Date: 2009-10-15 09:38:13
Message-ID: 000601ca4d7b$37bba140$e316840a@ming4937g (view raw or flat)
Thread:
Lists: pgsql-novice
hi there,
  i have trouble compiling a c style program ( filename with extension cpp) written for visual C++.
When i added the following #includes,
>>> #include "spi.h"
>>> #include "trigger.h"
compilation errors say "error C2899: typename cannot be used outside a template declaration".
I need the above includes for postgres triggers.

If the above #includes were removed, leaving behind  
>>>#include "postgres.h"
>>>#include "fmgr.h"
then there is no compilation error.

A check on msdn reveals that the error is because in visual c++, the word "typename" is a keyword.
Unfortunately, it happens ( coincidence) that postgres also uses the word "typename" in its header files, as in below - 
typedef struct ColumnDef
{
 NodeTag  type;
 char    *colname;  /* name of column */
 TypeName   *typename;  /* type of column */
...
}

I have thought of making visual c++ of not recognizing "typename" as a keyword, say, by turning some compiler options to forced c mode ( rather than c++).
Is there indeed such an option? If not, is there a way to resolve my problem as described above?

Would appreciate any help ...

thanks and regards,
baluku

pgsql-novice by date

Next:From: keshav upadhyayaDate: 2009-10-15 14:02:52
Subject: Regarding facing lot of time Consumed by Socket.Poll()
Previous:From: Thomas KellererDate: 2009-10-14 17:08:15
Subject: Re: mysql command equivalents?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group