If you're new and need a book

G

Gary Labowitz

Paul said:
news:XU2Xc.23719$L94.11173@fed1read07...
Second, the new Visual C++ 7.x compiler will *not* compile the code. The
reason is that there is no such file any more as <iostream.h>. Try it an
see for yourself. As a matter of fact, the top rated web-site that answers
C++ questions (which I have been an active member of now for 5 years, and
one of its biggest contributors as far as answering C++ questions), gets
queries from beginners as to why thei riostream.hladencodedoesn't
compile with the latest Visual C++ compiler.

Okay, got rid of precompiled headers (I'm lazy, but not that lazy) and now
<iostream.h> generates an error.
Shows what you get for using MS defaults.
 
M

Mike Wahler

Gary Labowitz said:
Second, the new Visual C++ 7.x compiler will *not* compile the code. The
reason is that there is no such file any more as <iostream.h>. Try it an
see for yourself. As a matter of fact, the top rated web-site that answers
C++ questions (which I have been an active member of now for 5 years, and
one of its biggest contributors as far as answering C++ questions), gets
queries from beginners as to why thei riostream.hladencodedoesn't
compile with the latest Visual C++ compiler.

I thought the bone of contention was the use of <iostream.h> so I (sorta)
automatically inserted std:: in front of the cout and tried the following
code in .NET (7.1.3088)

// t1.cpp : Defines the entry point for the console application.
//
#include <iostream.h>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "Hello, World!\n";
return 0;
}

I hate all the MS stdafx stuff, but that was generated by the project
builder. The above code compiles and runs just fine. So?

So, an implementation's behavior does not define correctness,
the language standard does.
The above ((even without the 'stdafx', with _tmain() changed to 'main(),
and _TCHAR changed to 'char'), is *not* standard compliant code.
Changing it to

#include <iostream.h>
#include "stdafx.h"
int main( )
{
std::cout << "Hello, World!\n";
return 0;
}

Still compiled and worked fine.

Same remarks as above.
[Now, how do I get rid of MS wanting
precompiled headers? OT OT OT OT!!!]

<OT>
It's in the menus. I don't know where in 7.1, but in 6.0
it's in the 'Project Settings' dialog, "C/C++" tab, category
"Precompiled headers". There are choices to not use, use
'automatic', or use 'manually'.
</OT>

-Mike
 
M

Mike Wahler

Paul said:
And what exactly do you disagree with? What version of NET? This will not
compile for VC++ 7.1, as noted by several that have that the compiler and
realize that <iostream.h> is no longer included.

The Comeau C++ compiler does the following with the program:
-----------------------------------------------------
Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"iostream.h", line 1: catastrophic error: #error directive:
<iostream.h> is not a Standard header, use <iostream> instead.
Note that when you change this header name, that identifiers such
as
"cout" and "endl" will no longer work, as they are in namespace
"std", so use be "std::cout" and "std::endl" respectively.
------------------------------------------
So again, what is a beginner who may be using a conforming ANSI C++ compiler
supposed to do when they get this or similar error message thrown at them
when they compile
their very first program?

From the error message above:

"<iostream.h> is not a Standard header, use <iostream> instead."

That seems pretty straightforward to me, shouldn't confuse even
a novice (unless he's been learning from an incorrect or outdated
book, in which case he *needs* to be informed, the sooner the better).

Reading the "Teach yourself C++" book will not
shed any light
on how to fix this problem.

IMO whatever the name of a C++ book, if it teaches using e.g.
<iostream.h>, *IT IS WRONG* and should not be used.

-Mike
 
G

Gary Labowitz

"<iostream.h> is not a Standard header, use <iostream> instead."

That seems pretty straightforward to me, shouldn't confuse even
a novice (unless he's been learning from an incorrect or outdated
book, in which case he *needs* to be informed, the sooner the better).



IMO whatever the name of a C++ book, if it teaches using e.g.
<iostream.h>, *IT IS WRONG* and should not be used.

Well, it is not standard. And wth a standard compliant compiler it won't
compile. And that's not useful.
So "wrong" isn't the right word!
What's really on topic here is that a book that teaches non-standard useage
is not useful to today's learner unless they stay with non-compliant
compilers, use extensions like that abysmal MS precompiled header, etc. The
book is outdated. It is difficult to drag people into the 21st century when
quite often the new versions don't work as well, smoothly, or the same way
as the old ones. I shudder to think of all the things I will have to wade
through to move "up" to .NET. (What in hell was wrong with VB 6.0?)
 
V

Victor Bazarov

Gary said:
[...] I shudder to think of all the things I will have to wade
through to move "up" to .NET. (What in hell was wrong with VB 6.0?)

"Everything" doesn't even begin to describe it. The sooner you move
to 7.1, the healthier you're going to be, and the more hair your head
is going to retain.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top