Hello,
While compiling a file, I get following error ....
=================================
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/g++/type_traits.h:14
2: redefinition of `struct __type_traits<short int>'
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/g++/type_traits.h:10
2: previous definition here
=================================
If I open file
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/g++/type_traits.h,
the source code looks like below,
=================================
94 #ifndef __STL_NO_BOOL
95
96 __STL_TEMPLATE_NULL struct __type_traits<bool> {
97 typedef __true_type has_trivial_default_constructor;
98 typedef __true_type has_trivial_copy_constructor;
99 typedef __true_type has_trivial_assignment_operator;
100 typedef __true_type has_trivial_destructor;
101 typedef __true_type is_POD_type;
102 };
103
104 #endif /* __STL_NO_BOOL */
....
<snip>
....
142 __STL_TEMPLATE_NULL struct __type_traits<short> {
143 typedef __true_type has_trivial_default_constructor;
144 typedef __true_type has_trivial_copy_constructor;
145 typedef __true_type has_trivial_assignment_operator;
146 typedef __true_type has_trivial_destructor;
147 typedef __true_type is_POD_type;
148 };
=================================
The macro __STL_NO_BOOL is NOT defined in my environment.
If I pass the file through the precompiler (using command gcc -E <file name,
inc paths etc.>), output shows above two templates as .....
=================================
template<> struct __type_traits< short > {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
....
<snip>
....
template<> struct __type_traits<short> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
=================================
These two templates are causing the redefinition problem and it is clear
that keyword "bool" is being resolved as "short".
I am using GCC 2.95.3 on RedHat 8.0 on Intel PIII.
- Can anyone give any directions regarding what could cause this problem?
- Secondly, though in my opinion bool is being resolved as short, the error
flagged by compiler says "redefinition of `struct __type_traits<short
int>'". As a result, I am not sure if what I think is incorrect or "short"
is same as "short int"?
Thanks,
Loma