C++ problems with RC1

From: teg(at)redhat(dot)com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=)
To: pgsql-hackers(at)postgresql(dot)org
Subject: C++ problems with RC1
Date: 2002-01-23 16:49:09
Message-ID: xuylmept3lm.fsf@halden.devel.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The autoconf test for C++ doesn't work with standard-enforcing
compilers....

[teg(at)halden teg]$ cat foo.C
#include <string>

int main(int argc, char **argv){
string foo="xyzzy";
return 0;
}
[teg(at)halden teg]$ c++ foo.C -o foo
foo.C: In function `int main(int, char**)':
foo.C:4: `string' undeclared (first use this function)
foo.C:4: (Each undeclared identifier is reported only once for each function it
appears in.)
foo.C:4: parse error before `=' token
[teg(at)halden teg]$

The standard mandates that string is accessed in one of the following
ways:

[teg(at)halden teg]$ cat foo2.C
#include <string>

using namespace std;

int main(int argc, char **argv){
string foo="xyzzy";
return 0;
}
[teg(at)halden teg]$ cat foo3.C
#include <string>

int main(int argc, char **argv){
std::string foo="xyzzy";
return 0;
}
[teg(at)halden teg]$

Some compilers accept the old way (and namespaces have been available
for quite some time now), others (like upcoming gcc 3.1) don't.
--
Trond Eivind Glomsrød
Red Hat, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-01-23 16:54:09 Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Previous Message Peter Eisentraut 2002-01-23 16:48:40 Re: pltcl build problem on FreeBSD (was: Re: pltlc and