#28 Problem compiling with STL headers

closed
nobody
None
5
2003-03-27
2003-03-26
No

g++ version:

g++.exe (GCC) 3.2 (mingw special 20020817-1)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.

MSYS 1.08

------------------------------------------------------------------

Trying to compile this little program:

#include <string>

int main()
{
string a,b;
a="Hallo";
b=a+a;
return 0;
}

gives me the following output:

hans@STRADER /c/projects/scheme/hscheme/infoSubS
ystem
$ g++ -c a.cxx
a.cxx: In function `int main()':
a.cxx:5: `string' undeclared (first use this function)
a.cxx:5: (Each undeclared identifier is reported only
once for each function it
appears in.)
a.cxx:5: parse error before `,' token
a.cxx:6: `a' undeclared (first use this function)
a.cxx:7: `b' undeclared (first use this function)

Same thing on Linux:

hd@ahriman:~$ g++ -c a.cxx
hd@ahriman:~$

I don't understand what the difference is here between
MinGW g++ and Linux g++ (except for the version
difference, because the Linux g++ is version 2.95.3.)

Best regards,
Hans Dijkema

Discussion

  • Earnie Boyd

    Earnie Boyd - 2003-03-27
    • labels: 456608 -->
    • milestone: 102881 -->
    • assigned_to: earnie --> nobody
     
  • Earnie Boyd

    Earnie Boyd - 2003-03-27

    Logged In: YES
    user_id=15438

    gcc 2.95.3 does not follow C++ standards. You must specify
    namespace in C++ standards compliant compilers. I.E. It is
    std::string and not just string.

    Earnie.

     
  • Earnie Boyd

    Earnie Boyd - 2003-03-27
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks