Thomson
Full Member level 3
hi,
Although searched some websites and referred to some documents, the following problems remained unsolved yet!
Although searched some websites and referred to some documents, the following problems remained unsolved yet!
Code:
#include <iostream>
#include <string>
int main()
{
int errors = 0;
string str("a very long literal string");
for (int ix=0; ix <100000; ++ix)
{
int len = str.size();
string str2 = str;
if (str != str2)
++errors;
}
}
cout << "string class: "
<< errors << "errors occured\n";
}
when compiled with g++ under linux, the followng information occured:
"string" undeclared! and of course some other warnings related to this error!
And i checked the search library that the g++ used when searching the standard library doesn't contain the C++ standard library, which is under another directory!
However, when i modifed the first include file to "iostream.h", then /usr/lib/c++ library is searched which contains the C++ standard library.
Can anybody tell me how to solve this?
Thanks in advance!
Thomson