libpq build problem with <io.h> on MS VC++ 7.0

Поиск
Список
Период
Сортировка
Искать
От
Andrew Francis
Тема
libpq build problem with <io.h> on MS VC++ 7.0
Дата
Msg-id
4119C627.5030402@familyhealth.com.au
Список
Hi all

When building libpq using Visual Studio .NET 2002 (ie Visual C++ 7.0), I 
encounter this error:

fe-lobj.c
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\io.h(205) : error 
C2375: 'pgrename' : redefinition; different linkage
         c:\libs\postgresql\src\include\port.h(148) : see declaration of 
'pgrename'
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\io.h(275) : error 
C2375: 'pgunlink' : redefinition; different linkage
         c:\libs\postgresql\src\include\port.h(149) : see declaration of 
'pgunlink'


As rename/unlink are #define'd to pgrename/pgunlink prior to 's inclusion.


Simply reordering the headers fixes the problem (see attachment).


I believe this may be a problem on my compiler, but not necessarily others, 
due to an additional compiler directive on the definition in io.h:

   #define _CRTIMP __declspec(dllimport)
      ...
   _CRTIMP int __cdecl unlink(const char *);

port.h's definition of pgrename() is obviously lacking a __declspec(dllimport).


Regards,

-- 
Andrew Francis
Lead Developer - Software
Family Health Network


*** fe-lobj-old.c	Wed Aug 11 14:56:16 2004
--- fe-lobj.c	Wed Aug 11 14:55:55 2004
***************
*** 13,33 ****
   *-------------------------------------------------------------------------
   */
- #include "postgres_fe.h"
  
! #include 
! #include 
! #include 
  
  #ifdef WIN32
  #include "win32.h"
- #include "io.h"
  #else
  #include 
  #endif
  
  #include "libpq-fe.h"
  #include "libpq-int.h"
  #include "libpq/libpq-fs.h"		/* must come after sys/stat.h */
- 
  
  #define LO_BUFSIZE		  8192
--- 13,40 ----
   *-------------------------------------------------------------------------
   */
  
! #ifdef WIN32
! /*
!  * As unlink/rename are #define'd in port.h (via postgres_fe.h), io.h
!  * must be included first.
!  */
! #include 
! #endif
! 
! #include "postgres_fe.h"
  
  #ifdef WIN32
  #include "win32.h"
  #else
  #include 
  #endif
  
+ #include 
+ #include 
+ #include 
+ 
  #include "libpq-fe.h"
  #include "libpq-int.h"
  #include "libpq/libpq-fs.h"		/* must come after sys/stat.h */
  
  #define LO_BUFSIZE		  8192
В списке pgsql-hackers-win32 по дате отправления
От: Tom Lane
Дата:
От: Dave Page
Дата:
FAQ