public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: gcc4.1.2 and 4.3.2 has different default behavior
       [not found] ` <mcrd3m0py91.fsf@google.com>
@ 2011-03-10  6:37   ` Yixuan Huang
  2011-03-10  6:47     ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Yixuan Huang @ 2011-03-10  6:37 UTC (permalink / raw)
  To: gcc-help

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@google.com> wrote:
> Yixuan Huang <yixuan178@gmail.com> 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@gcc.gnu.org.
> It would be appropriate for gcc-help@gcc.gnu.org.  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcc4.1.2 and 4.3.2 has different default behavior
  2011-03-10  6:37   ` gcc4.1.2 and 4.3.2 has different default behavior Yixuan Huang
@ 2011-03-10  6:47     ` Ian Lance Taylor
       [not found]       ` <AANLkTinToeSs1V7xkPWp0irPXkKAg51+rn4MW7y98ys=@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2011-03-10  6:47 UTC (permalink / raw)
  To: Yixuan Huang; +Cc: gcc-help

Yixuan Huang <yixuan178@gmail.com> writes:

> 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?

I don't entirely understand what you are saying.  I would expect that
<iostream> for gcc 4.1.2 would be in that directory,
/usr/include/c++/4.1.2.  Do you not see it there?  What do you see in
that directory?

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcc4.1.2 and 4.3.2 has different default behavior
       [not found]         ` <mcrsjuvezw3.fsf@google.com>
@ 2011-03-11  2:33           ` Yixuan Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Yixuan Huang @ 2011-03-11  2:33 UTC (permalink / raw)
  To: gcc-help

Thanks Ian,
Very useful information.

Thanks,
yixuan



On Thu, Mar 10, 2011 at 11:52 PM, Ian Lance Taylor <iant@google.com> wrote:
> Yixuan Huang <yixuan178@gmail.com> writes:
>
>> I can see iostream in that folder. I want to know what my .cpp file
>> include? How can I know for g++ compiler.
>> I tried to use g++ aa.cpp -v, but it can't show the exact header files.
>> I just want to check which exact file include string.h, Just curious on it.
>
> Please reply to the mailing list, not just to me.  Thanks.
>
> Run g++ --save-temps aa.cpp.  It will create a file aa.ii.  That file
> will list the exact header files included, in a format described in the
> cpp manual.
>
> Ian
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-11  2:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AANLkTimri--F2kMqo8X30o3-CPRRG4mu5ZYkM=Ub1yG0@mail.gmail.com>
     [not found] ` <mcrd3m0py91.fsf@google.com>
2011-03-10  6:37   ` gcc4.1.2 and 4.3.2 has different default behavior Yixuan Huang
2011-03-10  6:47     ` Ian Lance Taylor
     [not found]       ` <AANLkTinToeSs1V7xkPWp0irPXkKAg51+rn4MW7y98ys=@mail.gmail.com>
     [not found]         ` <mcrsjuvezw3.fsf@google.com>
2011-03-11  2:33           ` Yixuan Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).