Hi,

I've been experimenting with STL on solaris with the 7.0 sun compiler. I am able to write programs using string, map, vector, list, etc. however, I am trying to use hash_map and can't get the most basic (ie hash_map<string,string> h; ) to compile. It appears that hash_map is not part of the regular include path, and I've tried to find it in other places in the compiler's directories. While I've found it, it doesn't seem to compile. Does anyone have any ideas about this (understandably obscure/solaris specific) problem?

CC -V
CC: Forte Developer 7 C++ 5.4 2002/03/09

#include <algorithm>
#include <hash_map>
#include <string>
using namespace std;

int main()
{
        hash_map<string,string> myMap;
        return 0;
}
155 |/export/SUNWspro> find . -name 'hash_map*' -print
./prod/include/CC/stlport4/hash_map.SUNWCCh
./prod/include/CC/stlport4/hash_map
56 |/export/SUNWspro> find . -name '*stl*' -print
./prod/lib/stlport4
./prod/lib/stlport4/libp/libstlport.a
./prod/lib/stlport4/libstlport.a
./prod/lib/stlport4/libstlport_dbg.a
./prod/lib/stlport4/libstlport.so.1
./prod/lib/stlport4/v9/libstlport.so.1
./prod/lib/stlport4/v9/libp/libstlport.a
./prod/lib/stlport4/v9/libstlport.a
./prod/lib/stlport4/v9/libstlport_dbg.a
./prod/include/CC/stlport4
./prod/include/CC/stlport4/config/stl_confix.h
./prod/include/CC/stlport4/config/stl_solaris.h
./prod/include/CC/stlport4/config/stl_sunpro.h
./prod/include/CC/stlport4/config/stlcomp.h
./prod/include/CC/stlport4/stl
./prod/include/CC/stlport4/stl_user_config.h
./inventory/v10n1/SPROstl4h
./inventory/v10n1/SPROstl4a
./inventory/v10n1/SPROstl4o
./inventory/v10n1/SPROstl4x
./inventory/v10n1/SPROstl4y
./lib/stlport4
./lib/stlport4/libstlport.so
./lib/stlport4/libstlport.so.1
./lib/stlport4/v9/libstlport.so
./lib/stlport4/v9/libstlport.so.1

Compile attempt:

/export/SUNWspro/bin/CC  -w -c -I./ -I../libs -I/export/SUNWspro/prod/include/CC/stlport4  -g -D_DEBUG  -D__SUNOS__  -c *.cpp 
/export/SUNWspro/bin/CC  -Bdynamic -lsocket -lnsl  -L/export/SUNWspro/lib/stlport4 -lstlport  -lhoff *.o -o Test

I get the following warnings (many more, all roughly the same)

ld: warning: symbol `std::basic_stringbuf<char,std::char_traits<char>,std::allocator<char> >::__vtbl' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x40; file /export/SUNWspro/lib/libCstd.so value=0x3c);
        /export/SUNWspro/lib/stlport4/libstlport.so definition taken
ld: warning: symbol `std::time_get_byname<wchar_t,std::istreambuf_iterator<wchar_t,std::char_traits<wchar_t> > >::__vtbl' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x24; file /export/SUNWspro/lib/libCstd.so value=0x2c);
        /export/SUNWspro/lib/stlport4/libstlport.so definition taken
ld: warning: symbol `std::num_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::__vtbl' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x38; file /export/SUNWspro/lib/libCstd.so value=0x40);
        /export/SUNWspro/lib/stlport4/libstlport.so definition taken
ld: warning: symbol `std::moneypunct_byname<char,false>::__vtbl' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x30; file /export/SUNWspro/lib/libCstd.so value=0x38);
        /export/SUNWspro/lib/stlport4/libstlport.so definition taken
ld: warning: symbol `std::ctype<char>::__vtbl' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x2c; file /export/SUNWspro/lib/libCstd.so value=0x34);
        /export/SUNWspro/lib/stlport4/libstlport.so definition taken
ld: warning: symbol `std::codecvt_byname<char,char,__mbstate_t>::__vtbl' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x28; file /export/SUNWspro/lib/libCstd.so value=0x30);
        /export/SUNWspro/lib/stlport4/libstlport.so definition taken
ld: warning: symbol `std::clog' has differing sizes:
        (file /export/SUNWspro/lib/stlport4/libstlport.so value=0x68; file /export/SUNWspro/lib/libCstd.so value=0x60);

<< moderator edit: added [code][/code] tags -- though I'm not 100% sure about where I put them >>

Recommended Answers

All 2 Replies

What happens if you try to use a standard container, such as map? Same errors? Or is it specific to the extended containers and algorithms?

Works perfectly fine with map, vector, list, etc., without having to use any special include paths or libraries. No warnings on compilation either.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.