why???help me pls!!!

lam lamyx@public.szonline.net
Thu Sep 2 05:45:00 GMT 1999






dear sir:
    I wrote a programe(stl_map.c) 
below:
 
#include <algorithm> #include 
<string> #include <map> #include <iostream>
 
using namespace std;
 
int main(void) { //    map< string, 
char*, less<string> > m_st;   // for this 
declare OK.
    map< string, string, less<string> 
> m_st;    // for this declare error 
occur!
    string 
s1("abc"),s2="123";
    char t1[]="123";
  //    
m_st[s1]=t1;      // ok for first 
declare     m_st[s1]=s2;      // 
in this line an error occur when link,why???     
cout<<m_st["abc"]<<endl;     
    return 0; }
 
    The programe compile with gcc2.8.1 and 
libstdc++2.8.1.1(or libstdc++2.8.1)
in SUN_SPARC450/Solaris2.6(command line:g++ stl_map.c),an 
error occur:
    /usr/ccs/bin/as: "/var/tmp/cc0bUeGV.s", 
line 1610: error: can't compute value of  an expression involving an 
external symbol
    The programe can pass in windows_VC6.0 
or Linux_gcc. why???
 
                    
Best Regard
            
            lam
                        
9.2.1999



More information about the Gcc-bugs mailing list