This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
namespace problem
- To: egcs-bugs at cygnus dot com
- Subject: namespace problem
- From: Stephen Vavasis <vavasis at CS dot Cornell dot EDU>
- Date: Tue, 22 Sep 1998 16:09:54 -0400
- Organization: Cornell University
- Reply-To: vavasis at CS dot Cornell dot EDU
Are namespaces fully implemented in egcs-1.1? The Cygnus webpage states
that they are, but my namespace-test program below does not compile.
See the lengthy error message. The program compiles fine under Visual
C++ 5.0 and KCC 3.2f.
Thanks,
Steve Vavasis (vavasis@cs.cornell.edu)
#include <string>
namespace QMG {
using std::string;
string foo(char c);
}
QMG::string QMG::foo(char c) {
char st1[2];
st1[0] = c;
st1[1] = 0;
string s(st1);
return s;
}
syn.cs.cornell.edu> g++ -v -c testns1.cpp
Reading specs from
/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=91 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__
-D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix
-Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__
-Acpu(sparc) -Amachine(sparc) testns1.cpp /var/tmp/ccmiXv6z.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gnu/egcs-1.1b/include/g++
/usr/local/include
/usr/local/gnu/egcs-1.1b/sparc-sun-solaris2.5/include
/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/include
/usr/include
End of search list.
/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/cc1plus
/var/tmp/ccmiXv6z.ii -quiet -dumpbase testns1.cc -version -o
/var/tmp/cc23Or5A.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release)
(sparc-sun-solaris2.5) compiled by GNU C version egcs-2.91.57 19980901
(egcs-1.1 release).
testns1.cpp:8: syntax error before `::'
testns1.cpp:10: warning: ANSI C++ forbids declaration `' with no type
testns1.cpp:10: abstract declarator `int' used as declaration
testns1.cpp:10: `c' was not declared in this scope
testns1.cpp:11: warning: ANSI C++ forbids declaration `' with no type
testns1.cpp:11: abstract declarator `int' used as declaration
testns1.cpp:12: `st1' was not declared in this scope
testns1.cpp:13: parse error before `return'
testns1.cpp:17: confused by earlier errors, bailing out