Hello Ian, Thanks for information! I want to know where can I find include header files in iostream? Or is there some way to search it fast? I searched in /usr/include/c++/4.1.2, but can't find it. Can you help? Thanks, yixuan On Wed, Mar 9, 2011 at 3:08 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > Yixuan Huang <yixuan178@xxxxxxxxx> writes: > >> I have encountered one issue when write a simple test code. >> #inlcude <iostream> >> int main{ >> Â const char* str = "aaaa"; >> Â std::cout<<"str len: "<<strlen(str)<<std::endl; >> Âreturn 0; >> } >> >> If I compile on gcc version 4.1.2 20070115 (SUSE Linux), it can be >> compiled successfully. Otherwise, on gcc version 4.3.2 [gcc-4_3-branch >> revision 141291] (SUSE Linux), it will show >> linux-lht2:/home/yixuan # g++ aa.cpp >> aa.cpp: In function âint main()â: >> aa.cpp:6: error: âstrlenâ was not declared in this scope >> >> I don't know where can I get the information to explain the different behavior? > > This message is not appropriate for the mailing list gcc@xxxxxxxxxxxx > It would be appropriate for gcc-help@xxxxxxxxxxxx ÂPlease take any > followups to gcc-help. ÂThanks. > > gcc 4.3 is more careful about having one C++ header file include > another. ÂThe function strlen is defined in <string.h>. ÂIn gcc 4.1 > <iostream> #include'd <string.h>. ÂIn gcc 4.3 it does not. > > This is briefly mentioned at http://gcc.gnu.org/gcc-4.3/changes.html: > Â "Header dependencies have been streamlined, reducing unnecessary > Â Âincludes and pre-processed bloat." > > Ian >