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:1 4
2: redefinition of `struct __type_traits<s hort int>'
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/g++/type_traits.h:1 0
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<b ool> {
97 typedef __true_type has_trivial_def ault_constructo r;
98 typedef __true_type has_trivial_cop y_constructor;
99 typedef __true_type has_trivial_ass ignment_operato r;
100 typedef __true_type has_trivial_des tructor;
101 typedef __true_type is_POD_type;
102 };
103
104 #endif /* __STL_NO_BOOL */
....
<snip>
....
142 __STL_TEMPLATE_ NULL struct __type_traits<s hort> {
143 typedef __true_type has_trivial_def ault_constructo r;
144 typedef __true_type has_trivial_cop y_constructor;
145 typedef __true_type has_trivial_ass ignment_operato r;
146 typedef __true_type has_trivial_des tructor;
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_def ault_constructo r;
typedef __true_type has_trivial_cop y_constructor;
typedef __true_type has_trivial_ass ignment_operato r;
typedef __true_type has_trivial_des tructor;
typedef __true_type is_POD_type;
};
....
<snip>
....
template<> struct __type_traits<s hort> {
typedef __true_type has_trivial_def ault_constructo r;
typedef __true_type has_trivial_cop y_constructor;
typedef __true_type has_trivial_ass ignment_operato r;
typedef __true_type has_trivial_des tructor;
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 "redefiniti on of `struct __type_traits<s hort
int>'". As a result, I am not sure if what I think is incorrect or "short"
is same as "short int"?
Thanks,
Loma
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:1 4
2: redefinition of `struct __type_traits<s hort int>'
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/g++/type_traits.h:1 0
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<b ool> {
97 typedef __true_type has_trivial_def ault_constructo r;
98 typedef __true_type has_trivial_cop y_constructor;
99 typedef __true_type has_trivial_ass ignment_operato r;
100 typedef __true_type has_trivial_des tructor;
101 typedef __true_type is_POD_type;
102 };
103
104 #endif /* __STL_NO_BOOL */
....
<snip>
....
142 __STL_TEMPLATE_ NULL struct __type_traits<s hort> {
143 typedef __true_type has_trivial_def ault_constructo r;
144 typedef __true_type has_trivial_cop y_constructor;
145 typedef __true_type has_trivial_ass ignment_operato r;
146 typedef __true_type has_trivial_des tructor;
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_def ault_constructo r;
typedef __true_type has_trivial_cop y_constructor;
typedef __true_type has_trivial_ass ignment_operato r;
typedef __true_type has_trivial_des tructor;
typedef __true_type is_POD_type;
};
....
<snip>
....
template<> struct __type_traits<s hort> {
typedef __true_type has_trivial_def ault_constructo r;
typedef __true_type has_trivial_cop y_constructor;
typedef __true_type has_trivial_ass ignment_operato r;
typedef __true_type has_trivial_des tructor;
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 "redefiniti on of `struct __type_traits<s hort
int>'". As a result, I am not sure if what I think is incorrect or "short"
is same as "short int"?
Thanks,
Loma
Comment