Basic Question on using libstdc++-v3
Meenaradchagan Vishnu
mvishnu@fore.com
Thu Oct 7 14:07:00 GMT 1999
I installed the libstdc++-v3 and did a make check and make check-install,
everything passes (except for some illegal options --A to size complaints).
Now I try to compile a small toy program using the libstdc++-v3 in my
machine (Solaris).
The program is
#include <ext/hash_map>
#include <iostream>
static const int N = 100;
struct X
{
int a;
int b;
};
int main()
{
std::hash_map<int, X> hm;
for( int i = 0; i < N; ++i )
{
X x;
x.a = N-i;
x.b = 3*i;
hm[ i ] = x;
}
for( int i = 0; i < N; ++i )
{
std::cout << hm[ i ].a << " - " << hm[ i ].b << std::endl;
}
}
and I issued the following command:
/usr/local/bin/g++ -g -Wall -ftemplate-depth-25 -static
-I/usr/local/include/g++-v3 -L/usr/local/lib -o test_hm test_hm.cc
and I get the following error messages (see below). Any help in
identifying what I am doing wrong is much appreciated.
Meenan
/usr/local/bin/g++ -g -Wall -ftemplate-depth-25 -static
-I/usr/local/include/g++-v3 -L/usr/local/lib -o test_hm test_hm.cc
In file included from test_hm.cc:1:
/usr/local/include/g++-v3/ext/hash_map:44: syntax error before `template'
/usr/local/include/g++-v3/ext/hash_map:51: parse error before `&'
/usr/local/include/g++-v3/ext/hash_map:52: `operator ==(...)' must have an
argument of class or enumerated type
/usr/local/include/g++-v3/ext/hash_map:52: `operator ==(...)' must take exactly
two arguments
/usr/local/include/g++-v3/ext/hash_map:59: parse error before `,'
/usr/local/include/g++-v3/ext/hash_map:61: syntax error before `;'
/usr/local/include/g++-v3/ext/hash_map:64: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:64: `key_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:64: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:67: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:67: `value_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:67: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:68: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:68: `hasher' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:68: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:69: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:69: `key_equal' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:69: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:71: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:71: `size_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:71: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:72: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:72: `difference_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:72: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:73: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:73: `pointer' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:73: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:74: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:74: `const_pointer' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:74: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:75: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:75: `reference' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:75: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:76: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:76: `const_reference' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:76: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:78: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:78: `iterator' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:78: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:79: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:79: `const_iterator' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:79: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:81: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:81: `allocator_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:81: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:164: `__STD_QUALIFIER' is neither
function nor method; cannot be declared friend
/usr/local/include/g++-v3/ext/hash_map:164: parse error before `operator'
/usr/local/include/g++-v3/ext/hash_map:174: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:181: semicolon missing after declaration
of `hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map()':
/usr/local/include/g++-v3/ext/hash_map:88: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int)':
/usr/local/include/g++-v3/ext/hash_map:90: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int, const int &)':
/usr/local/include/g++-v3/ext/hash_map:92: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int, const int &, const
int &, const int & = int())':
/usr/local/include/g++-v3/ext/hash_map:95: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(const int *, const int
*)':
/usr/local/include/g++-v3/ext/hash_map:120: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(const int *, const int
*, int)':
/usr/local/include/g++-v3/ext/hash_map:123: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(const int *, const int
*, int, const int &)':
/usr/local/include/g++-v3/ext/hash_map:127: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(const int *, const int
*, int, const int &, const int &, const int & = int())':
/usr/local/include/g++-v3/ext/hash_map:132: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int, int)':
/usr/local/include/g++-v3/ext/hash_map:136: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int, int, int)':
/usr/local/include/g++-v3/ext/hash_map:139: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int, int, int, const int
&)':
/usr/local/include/g++-v3/ext/hash_map:143: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: In method
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>::hash_map(int, int, int, const int
&, const int &, const int & = int())':
/usr/local/include/g++-v3/ext/hash_map:148: class
`hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>' does not have any field named
`_M_ht'
/usr/local/include/g++-v3/ext/hash_map: At top level:
/usr/local/include/g++-v3/ext/hash_map:181: parse error before `*'
/usr/local/include/g++-v3/ext/hash_map:181: two or more data types in
declaration of `insert'
/usr/local/include/g++-v3/ext/hash_map:181: semicolon missing after declaration
of `class hash_map<_Key,_Tp,_HashFcn,_EqualKey,_Alloc>'
/usr/local/include/g++-v3/ext/hash_map:184: `const_iterator' was not declared in
this scope
/usr/local/include/g++-v3/ext/hash_map:184: parse error before `,'
/usr/local/include/g++-v3/ext/hash_map: In function `void insert(...)':
/usr/local/include/g++-v3/ext/hash_map:185: `_M_ht' undeclared (first use this
function)
/usr/local/include/g++-v3/ext/hash_map:185: (Each undeclared identifier is
reported only once
/usr/local/include/g++-v3/ext/hash_map:185: for each function it appears in.)
/usr/local/include/g++-v3/ext/hash_map:185: `__f' undeclared (first use this
function)
/usr/local/include/g++-v3/ext/hash_map:185: `__l' undeclared (first use this
function)
/usr/local/include/g++-v3/ext/hash_map: At top level:
/usr/local/include/g++-v3/ext/hash_map:187: `iterator' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:187: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:190: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:191: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:194: syntax error before `&'
/usr/local/include/g++-v3/ext/hash_map:198: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:200: `iterator' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:200: `iterator' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:200: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:202: `const_iterator' was not declared in
this scope
/usr/local/include/g++-v3/ext/hash_map:202: `const_iterator' was not declared in
this scope
/usr/local/include/g++-v3/ext/hash_map:203: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:206: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:207: `iterator' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:207: parse error before `)'
/usr/local/include/g++-v3/ext/hash_map: In function `void erase(...)':
/usr/local/include/g++-v3/ext/hash_map:207: `__it' undeclared (first use this
function)
/usr/local/include/g++-v3/ext/hash_map: At top level:
/usr/local/include/g++-v3/ext/hash_map:208: parse error before `,'
/usr/local/include/g++-v3/ext/hash_map: In function `void erase(...)':
/usr/local/include/g++-v3/ext/hash_map:208: redefinition of `void erase(...)'
/usr/local/include/g++-v3/ext/hash_map:207: `void erase(...)' previously defined
here
/usr/local/include/g++-v3/ext/hash_map: At top level:
/usr/local/include/g++-v3/ext/hash_map:211: `size_type' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:211: parse error before `)'
/usr/local/include/g++-v3/ext/hash_map: In function `void resize(...)':
/usr/local/include/g++-v3/ext/hash_map:211: `__hint' undeclared (first use this
function)
/usr/local/include/g++-v3/ext/hash_map: At top level:
/usr/local/include/g++-v3/ext/hash_map:212: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:213: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:214: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:248: `hash' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:248: parse error before `>'
/usr/local/include/g++-v3/ext/hash_map:249: `equal_to' was not declared in this
scope
/usr/local/include/g++-v3/ext/hash_map:249: parse error before `>'
/usr/local/include/g++-v3/ext/hash_map:249: conflicting types for `class
_EqualKey (* __STL_DEPENDENT_DEFAULT_TMPL)(...)'
/usr/local/include/g++-v3/ext/hash_map:248: previous declaration as `class
_HashFcn (* __STL_DEPENDENT_DEFAULT_TMPL)(...)'
/usr/local/include/g++-v3/ext/hash_map:250: parse error before `('
/usr/local/include/g++-v3/ext/hash_map:255: parse error before `&'
/usr/local/include/g++-v3/ext/hash_map:256: `operator ==(...)' must have an
argument of class or enumerated type
/usr/local/include/g++-v3/ext/hash_map:256: `operator ==(...)' must take exactly
two arguments
/usr/local/include/g++-v3/ext/hash_map:263: parse error before `,'
/usr/local/include/g++-v3/ext/hash_map:266: syntax error before `;'
/usr/local/include/g++-v3/ext/hash_map:269: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:269: `key_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:269: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:269: invalid member template declaration
`hash_multimap::key_type'
/usr/local/include/g++-v3/ext/hash_map:270: invalid member template declaration
`hash_multimap::data_type'
/usr/local/include/g++-v3/ext/hash_map:271: invalid member template declaration
`hash_multimap::mapped_type'
/usr/local/include/g++-v3/ext/hash_map:272: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:272: `value_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:272: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:272: invalid member template declaration
`hash_multimap::value_type'
/usr/local/include/g++-v3/ext/hash_map:273: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:273: `hasher' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:273: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:273: invalid member template declaration
`hash_multimap::hasher'
/usr/local/include/g++-v3/ext/hash_map:274: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:274: `key_equal' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:274: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:274: invalid member template declaration
`hash_multimap::key_equal'
/usr/local/include/g++-v3/ext/hash_map:276: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:276: `size_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:276: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:276: invalid member template declaration
`hash_multimap::size_type'
/usr/local/include/g++-v3/ext/hash_map:277: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:277: `difference_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:277: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:277: invalid member template declaration
`hash_multimap::difference_type'
/usr/local/include/g++-v3/ext/hash_map:278: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:278: `pointer' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:278: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:278: invalid member template declaration
`hash_multimap::pointer'
/usr/local/include/g++-v3/ext/hash_map:279: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:279: `const_pointer' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:279: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:279: invalid member template declaration
`hash_multimap::const_pointer'
/usr/local/include/g++-v3/ext/hash_map:280: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:280: `reference' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:280: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:280: invalid member template declaration
`hash_multimap::reference'
/usr/local/include/g++-v3/ext/hash_map:281: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:281: `const_reference' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:281: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:281: invalid member template declaration
`hash_multimap::const_reference'
/usr/local/include/g++-v3/ext/hash_map:283: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:283: `iterator' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:283: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:283: invalid member template declaration
`hash_multimap::iterator'
/usr/local/include/g++-v3/ext/hash_map:284: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:284: `const_iterator' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:284: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:284: invalid member template declaration
`hash_multimap::const_iterator'
/usr/local/include/g++-v3/ext/hash_map:286: `_Ht' is not a class or namespace
/usr/local/include/g++-v3/ext/hash_map:286: `allocator_type' is not a class or
namespace
/usr/local/include/g++-v3/ext/hash_map:286: `_Ht' fails to be a typedef or built
in type
/usr/local/include/g++-v3/ext/hash_map:286: invalid member template declaration
`hash_multimap::allocator_type'
/usr/local/include/g++-v3/ext/hash_map:288: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:289: syntax error before `('
/usr/local/include/g++-v3/ext/hash_map:289: non-member function `key_eq()'
cannot have `const' method qualifier
/usr/local/include/g++-v3/ext/hash_map: In function `int key_eq()':
/usr/local/include/g++-v3/ext/hash_map:289: confused by earlier errors, bailing
out
make: *** [test_hm] Error 1
--Team_of_Horses_884_000--
More information about the Libstdc++
mailing list