LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   getting error in gcc (https://www.linuxquestions.org/questions/linux-general-1/getting-error-in-gcc-4175425402/)

naveennaik 09-03-2012 07:10 AM

getting error in gcc
 
Hi all,

I am compiling code in RHEL 6.2 which is already compiled successfully in RHEL 5.2.. getting lots of standard error related to namespace

please let me know the resolution for this.

errors like:

Generating /udir/naveen/from_35/data/objectstore/abl.adb & osschema_libabl.cc (-assf flag)
"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/stringfwd.h", line 42: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cstddef", line 49: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 65: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 139: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 238: error:
expected a "{"
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 260: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 262: error:
name followed by "::" must be a class or namespace name
using ::__gnu_cxx::wcstold;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 263: error:
name followed by "::" must be a class or namespace name
using ::__gnu_cxx::wcstoll;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cwchar", line 264: error:
name followed by "::" must be a class or namespace name
using ::__gnu_cxx::wcstoull;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/postypes.h", line 70: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 44: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 46: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 49: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 52: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 55: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 58: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 61: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT>,
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 62: error:
allocator is not a template
typename _Alloc = allocator<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 65: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT>,
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 66: error:
allocator is not a template
typename _Alloc = allocator<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 69: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT>,
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 70: error:
allocator is not a template
typename _Alloc = allocator<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 73: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT>,
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 74: error:
allocator is not a template
typename _Alloc = allocator<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 77: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 80: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 83: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 86: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 89: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd", line 92: error:
char_traits is not a template
template<typename _CharT, typename _Traits = char_traits<_CharT> >
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/exception", line 120: error:
expected a "{"
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/functexcept.h", line 39: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/cpp_type_traits.h", line 69: error:
expected a "{"
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/cpp_type_traits.h", line 76: error:
expected a "{"
namespace std __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/cpp_type_traits.h", line 310: error:
name followed by "::" must be a class or namespace name
struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/cpp_type_traits.h", line 310: error:
too many arguments for class template "<error>::__is_normal_iterator"
struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ext/type_traits.h", line 37: error:
expected a "{"
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ext/type_traits.h", line 64: error:
namespace "std" has no member "__is_integer"
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ext/type_traits.h", line 64: error:
type name is not allowed
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ext/type_traits.h", line 64: error:
too few arguments for class template "<error>::__enable_if"
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ext/type_traits.h", line 64: error:
template parameter "_Tp" may not be redeclared in this scope
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
^

"/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ext/type_traits.h", line 64: error:
expected a ";"
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
^

knudfl 09-03-2012 08:44 AM

Welcome to LQ.

Probably use "The other compiler" = gcc34 :
# yum install compat-gcc-34-c++
... which will provide /usr/bin/ gcc34 g++34

.

naveennaik 09-04-2012 12:48 AM

Can we use gcc lower version in 6.2 RHEL, what about dependencies?
Should I need to uninstall all gcc rpms and install rpms from lower version?

John VV 09-04-2012 04:22 AM

Quote:

Should I need to uninstall all gcc rpms and install rpms from lower version?
NO
you can have a few different versions installed at the SAME time

on SL6.3 i have 4.4 and 3.4
on OpenSUSE 12 i have 3.4 ,4.1,4.3,4.6

some "older" programs will NOT build with the newer " more STRICT" versions

search the RHN repo
Code:

su -
yum search gcc

gcc.x86_64 -- is the current
compat-gcc-34.x86_64 -- is the compatibility old compiler
you also might want the "Compatibility libraries" group and "Development tools"
Code:

su -
yum grouplist
---- from the list ---
yum groupinstall "Compatibility libraries" "Development tools"


knudfl 09-04-2012 08:31 AM

Quote:

Can we use gcc lower version in 6.2 RHEL, what about dependencies ?
Compilers usually have few dependencies, older versions : None.

You can have have as may versions of gcc / g++ (c++) as you want,
installed at the same time. They have unique file names / location :
No conflicts.

Just write CC=gcc34 , CXX=g++34 in your Makefile, or use :
export CC=gcc34 CXX=g++34 && ./configure && make

Sometimes this can be used too : make CC=gcc34 CXX=g++34

.

naveennaik 09-05-2012 03:54 AM

Ya, Thanks for the reply.

I will be trying this, I think it should work.

Thanks.


All times are GMT -5. The time now is 06:44 AM.