Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fovmn-0007mC-PL for pgsql-general@arkaria.postgresql.org; Sun, 12 Aug 2018 19:12:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fovml-0001xg-9E for pgsql-general@arkaria.postgresql.org; Sun, 12 Aug 2018 19:12:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fovml-0001xZ-1Y for pgsql-general@lists.postgresql.org; Sun, 12 Aug 2018 19:12:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fovmi-0002oR-EI for pgsql-general@postgresql.org; Sun, 12 Aug 2018 19:12:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7CJCEYg001608; Sun, 12 Aug 2018 15:12:14 -0400 From: Tom Lane To: TalGloz cc: pgsql-general@postgresql.org Subject: Re: PostgreSQL C Language Extension with C++ Code In-reply-to: <1534099202325-0.post@n3.nabble.com> References: <1534093538827-0.post@n3.nabble.com> <1534097342417-0.post@n3.nabble.com> <31921.1534098408@sss.pgh.pa.us> <1534099202325-0.post@n3.nabble.com> Comments: In-reply-to TalGloz message dated "Sun, 12 Aug 2018 11:40:02 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1606.1534101134.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 12 Aug 2018 15:12:14 -0400 Message-ID: <1607.1534101134@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk TalGloz writes: > But now my compiler throws some other errors when running make: > myfunc.cpp:29:10: error: conflicting declaration of C function ‘int64_t > sum_of_numbers()’ > int64_t sum_of_numbers(){ > ^~~~~~~~~~~~~~ Well, yeah, you forgot to repeat the argument list here. For that matter, spelling Datum as int64_t is a recipe for trouble, even if it works on some particular platform. Should be Datum sum_of_numbers(PG_FUNCTION_ARGS) { ... > Why is it so hard to use C++ with PostgerSQL for a C extension? :) Probably because you've failed to break your bad C++ habits. regards, tom lane