Subject: [comp.databases: POSTGRES and C++ program compilation--------]

From: [email-masked] (Paul M. Aoki)
Date: Fri, 09 Sep 94 21:50:31 -0700

------- Forwarded Message

 Newsgroups:  comp.databases
 From:  Paul M. Aoki <[email-masked]>
 Subject:  Re: POSTGRES and C++ program compilation--------
 Date:  10 Sep 1994 04:49:35 GMT

 [email-masked] (I.A.) writes:
 >If any one knows the solution, I will appreciate the reply. My question is 
 >related to the compilation of a sample C++ program given in the subdir 
 >postgres/src/contrib/cplusplus/pgtest.c of version 4.2. I am trying to 
 >compile this sample code using AT&T C++ compiler version 1.3 on sun sparc
 >workstation using SunOS Release 4.1.2.
 >
 >Complier is giving me some error messages which I believe have something to do
 >with the postgres only as my normal C++ programs don't have any problem during
 >compilation. Following is the compilation command and the error messages:
 >
 >% CC -I/usr/local/postgres/include pgtest.c
 >"/usr/local/attc++/incl/stdlib.h", line 51: error: two perror()s with c linkage
 >"/usr/local/attc++/incl/malloc.h", line 41: error: two mallinfo()s with c linkage
 >2 errors
 >%
 
 the 0-second workaround is to use g++, which doesn't have this problem.
 
 the 1-second hack-job workaround is:
 
 sealion:aoki (16)> CC -I/private/aoki/postgres/include pgtest.c /private/aoki/postgres/lib/libpq.a
 CC: "/usr/include/stdlib.h", line 169: error: two getopt()s with c linkage (1101)
 CC: "/usr/include/errno.h", line 15: error: two perror()s with c linkage (1101)
 sealion:aoki (17)> CC -D_STDLIB_INCLUDED -I/private/aoki/postgres/include pgtest.c /private/aoki/postgres/lib/libpq.a
 sealion:aoki (18)> 
 
 (the -D symbol to define depends on your stdlib.h)
 
 notice that you need to include libpq.a or the program won't be able
 to link.  (it's included in the Makefile.)
 
 the 10-second hack-job workaround is:
 
 sealion:aoki (79)> rcsdiff pg.h
 RCS file: RCS/pg.h,v
 retrieving revision 1.2
 rdiff  -r1.2 pg.h
 15d14
 < #include <string.h>
 21a21
 > #include "tmp/c.h"
 27a28,29
 > #include <string.h>
 sealion:aoki (80)> 

------- End of Forwarded Message
--
  Paul M. Aoki          |  University of California at Berkeley
  [email-masked]  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================