help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple program does not compile with g++-4.3 but with g++-4.2


From: Emanoil Kotsev
Subject: Re: simple program does not compile with g++-4.3 but with g++-4.2
Date: Fri, 21 Aug 2009 18:00:59 +0200
User-agent: KNode/0.10.9

Thomas Maeder wrote:

> Emanoil Kotsev <deloptes@yahoo.com> writes:
> 
>> Hello, I'm trying to learn a bit more of c++. Unfortunately what was
>> working in g++ 4.2 is not working in 4.3 anymore. Why?
> 
> The code you give below has never been valid since C++ was stadardized
> 11 years ago.
> 
> 
>> I don't think I'm suppose to be changing my code because of this or
>> knowing what somebody did change in the compiler. Perhaps I'm
>> missing something like compatibility for 4.3.
> 
> You'll have to.
> 
> 
>> #include <iostream.h>
> 
> This not a C++ header. Do
> 
> #include <iostream>
> #include <ostream>
> 
> instead. <iostream> provides the object cout and <ostream> those
> overloads of << which are not member functions.
> 
> 
>> int main()
>> {
>>   cout << "The size of an int is:\t\t" << sizeof(int) << " bytes \n";
> 
> Note that cout belongs to namespace std. You either have to add a
> using directive or declaration, or (prefered by me), write
> 
>   std::cout << "The size of an int is:\t\t" << sizeof(int) << " bytes\n";

thanks for explaining the issue. I've got this from a book called learn c++
in 21 days (as I already have a good experience in C and perl objects) it's
really not hard to progress

Well part of the question (or the main point was) why it's working in 4.2
and not in 4.3

thus suddenly it won't compile. To me it does not look like a change made 11
years ago but yesterday also I know the .h at the end is wrong but it's
compiling with 4.2.

I would like to be able to compile my code in the future that's all.

I don't like somebody to decide on behalf of me if I should port my code or
not. This is called integrity and compatibility and the present situation
is absolutely not reliable.

regards








reply via email to

[Prev in Thread] Current Thread [Next in Thread]