compilation error on Fedora 17 with gcc version - 4.7.2 20120921 (Red Hat 4.7.2-2)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

compilation error on Fedora 17 with gcc version - 4.7.2 20120921 (Red Hat 4.7.2-2)

Sharwan Joram
Hello ,
  I'am trying to compile a small test program on my Linux box (fedora 17) with gcc version - 4.7.2 20120921 (Red Hat 4.7.2-2)
  but failing with following errors.
         
#include <iostream>
using namespace std;
int main()
{
        cout<<"Hello World!\n";
        cin.get();
}

 
------------ Error in compilation ------------


In file included from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:39:0,
                 from test.cpp:3:
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/i686-redhat-linux/bits/c++config.h: In function ‘int main()’:
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/i686-redhat-linux/bits/c++config.h:171:1: error: ‘namespace’ definition is not allowed here
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iosfwd:41:0,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ios:39,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:40,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:40,
                 from test.cpp:3:
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stringfwd.h:43:15: error: expected ‘=’ before ‘__attribute__’
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stringfwd.h:43:15: error: expected identifier before ‘__attribute__’
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stringfwd.h:43:15: error: expected ‘;’ before ‘__attribute__’
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stringfwd.h:43:15: error: expected primary-expression before ‘__attribute__’
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stringfwd.h:43:15: error: expected ‘;’ before ‘__attribute__’
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/cwchar:46:0,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/postypes.h:42,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iosfwd:42,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ios:39,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:40,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:40,
                 from test.cpp:3:
/usr/include/wchar.h:129:1: error: expected unqualified-id before string constant
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ios:40:0,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:40,
                 from /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:40,
                 from test.cpp:3:
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/exception:37:37: error: expected ‘}’ before end of line
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/exception: At global scope:
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/exception:37:37: error: expected declaration before end of line

After doing some search on google i found that is is a known issue of 4.7.2 gcc-c++ , but does anyone have a fix for this ?

--Sharwan
_______________________________________________
help-gplusplus mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-gplusplus