Can anybody have idea about the difference between #include
<iostream.h> and
#include <iostream>. Is later one valid statement on any compiler. I
tried compiling on MSVC second statement give compilation error as
#include expect filename.
Anu help would be appreciated.
thanx,
John 10 89396
John Tiger wrote: Can anybody have idea about the difference between #include <iostream.h> and #include <iostream>. Is later one valid statement on any compiler. I tried compiling on MSVC second statement give compilation error as #include expect filename.
Anu help would be appreciated.
thanx, John
For newer versions of gcc (3.x I think) iostream.h is deprecated. I've
always used iostream.h when dealing with ms and mipspro.
-Otto
"John Tiger" <um****@hotmail .com> wrote... Can anybody have idea about the difference between #include <iostream.h> and #include <iostream>. Is later one valid statement on any compiler. I tried compiling on MSVC second statement give compilation error as #include expect filename.
<iostream> is a standard header where certain objects are declared.
<iostream.h> is its obsolete incarnation, it has never been standard
and existed in pre-standard era only.
There is no requirement in the Standard that headers should exist in
a file form.
#include <iostream>
is a standard way to incorporate the declarations of those certain
objects into your code. It is valid on all compilers that are
Standard-compliant.
Questions on MSVC should be asked in microsoft.publi c.vc.language.
It is quite possible that the version you have is too old to be at
all compliant (released before the language was standardised, for
example).
Victor
#include <iostream> is the Standard C++ way to include header files, the
'iostream' is an identifier that maps to the file iostream.h. In older C++
you had to specify the filename of the header file, hence #include
<iostream.h>. Older compilers may not recognise the modern method, newer
compilers will accept both methods but the old method is obsolete.
iostream.h became iostream
fstream.h becams fstream
vector.h became vector
string.h became sting etc.
"John Tiger" <um****@hotmail .com> wrote in message
news:58******** *************** ***@posting.goo gle.com... Can anybody have idea about the difference between #include <iostream.h> and #include <iostream>. Is later one valid statement on any compiler. I tried compiling on MSVC second statement give compilation error as #include expect filename.
Anu help would be appreciated.
thanx, John
"Wawa" <S.***********@ student.lboro.a c.uk> wrote in message
news:dm******** *************@n ewsfep2-win.server.ntli .net... #include <iostream> is the Standard C++ way to include header files, the 'iostream' is an identifier that maps to the file iostream.h. In older
C++ you had to specify the filename of the header file, hence #include <iostream.h>. Older compilers may not recognise the modern method, newer compilers will accept both methods but the old method is obsolete.
iostream.h became iostream fstream.h becams fstream vector.h became vector string.h became sting etc.
Not true.
string and string.h are both standard header files that do completely
different things.
The other .h files are non-standard, it is not the case a compiler will
accept both.
john #include <iostream> is the Standard C++ way to include header files, the 'iostream' is an identifier that maps to the file iostream.h. In older C++ you had to specify the filename of the header file, hence #include <iostream.h>. Older compilers may not recognise the modern method,
newer compilers will accept both methods but the old method is obsolete.
iostream.h became iostream fstream.h becams fstream vector.h became vector string.h became sting etc.
Not true.
string and string.h are both standard header files that do completely different things.
The other .h files are non-standard, it is not the case a compiler will accept both.
john
I just like to add that the .h extension denotes a C header file, while the
..hpp extension denotes a C++ header file. Maybe someone can clarify this?.
Side note: I assume a header file is like the import statement in Java?
WD
Web Developer wrote: #include <iostream> is the Standard C++ way to include header files, the 'iostream' is an identifier that maps to the file iostream.h. In older C++ you had to specify the filename of the header file, hence #include <iostream.h>. Older compilers may not recognise the modern method, newer compilers will accept both methods but the old method is obsolete.
iostream.h became iostream fstream.h becams fstream vector.h became vector string.h became sting etc.
Not true.
string and string.h are both standard header files that do completely different things.
The other .h files are non-standard, it is not the case a compiler will accept both.
john
I just like to add that the .h extension denotes a C header file, while the .hpp extension denotes a C++ header file. Maybe someone can clarify this?.
You need to understand that the extension is just a convention.
Whatever filename you plug into
#include "whatever"
will be pulled in by the preprocessor.
Side note: I assume a header file is like the import statement in Java?
It is an order to the preprocessor to replace the line containing #include
with the actual content of the specified file. Nothing more, nothing less.
--
Karl Heinz Buchegger kb******@gascad .at string.h became sting etc.
Not true.
string and string.h are both standard header files that do completely different things.
I thought that the current standard called string.h cstring to avoid
ambiguity. "string.h" is a standard header file in C, but I didn't
think it was supposed to be used by the C++ standard. The other .h files are non-standard, it is not the case a compiler will accept both.
john
"Noah Roberts" <nr******@donte mailme.com> wrote... string.h became sting etc.
Not true.
string and string.h are both standard header files that do completely different things.
I thought that the current standard called string.h cstring to avoid ambiguity. "string.h" is a standard header file in C, but I didn't think it was supposed to be used by the C++ standard.
It's used for compatibility reasons along with 17 other C headers.
Victor
"Web Developer" <no****@hotmail .com> wrote in message news:<3f******* *@news.iprimus. com.au>... I just like to add that the .h extension denotes a C header file, while the .hpp extension denotes a C++ header file. Maybe someone can clarify this?.
This is convention, but you'll see a ton of headers with C++-only
constructs in .h files as well. There are also other conventions that
are less common; instead of .cpp sometimes .C (if you have a case
sensitive filesystem) or .cxx or even .c++ if your filesystem supports
that filename are used, and the corrosponding .H, .hxx, and .h++ are
also occasionally seen.
Side note: I assume a header file is like the import statement in Java?
They are somewhat similar, but there are significant differences.
import only pulls some names into scope, for instance with an import
javax.swing.* you'll only have to use the identifier JPanel instead of
javax.swing.JPa nel. In this sense it's like a using statement. (I
chose "statement" to leave the exact meaning ambiguous; the above
import is like a using directive, while if i had said import
javax.swing.JPa nel that's analogous to a using declaration.)
#include <filename> and #include "filename" actually put the contents
of filename into the current file. This is necessary because there is
(thankfully IMO) no way of knowing where the compiler (or VW in the
case of Java) should go to find things if I just write the following
C++ file:
int main () {
std::cout << "Hello mars!\n";
}
It doesn't know about the namespace std or the object std::cout.
Whereas if I write a similar Java program
class neededClass {
static int main() {
System.out.writ eln("Hello mars!\n");
}
}
it knows where to find System, then System.out because of the standard
naming scheme.
Does that help? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ai |
last post by:
Hi ,
I have an application which has to read files of size few mba nd read
them into array . Since i am using STL and std namespace to avoid the
error
error C2872: 'ifstream' : ambiguous symbol
when i include <iostream.h> with std namespace and <List>
|
by: zerotyNONONOTHERESNOSPAMMING!type |
last post by:
Hi,
As most of you probably already know, depending on which
implementation of C++ you have, #include <iostream> may cause various
other headers to be #included too. (I've observed cstring, cstdio,
cmath and I think cstdlib in g++)
Are there any that the standard requires to be "dragged in" like this
regardless of implementation?
|
by: ya man |
last post by:
when i use #include <iostream.h> in some files
i get lots of error messages of the kind 'ambiguous symbol
this is solved when i use #include <iostream
why is that ? and can i use #include <iostream.h> in some way
examples to the error messages
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\streamb.h(90): error C2872: 'ios' : ambiguous symbo
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\streamb.h(90): error C2872:...
|
by: Brett |
last post by:
Hi,
I'm compiling an old project under the 'new' visual studio 7.1.3088.
I changed the line:
#include <iostream.h>
to
#include <iostream>
and now I get a stack of errors, some of which are:
|
by: nichas |
last post by:
I tried to use #include<iostream> in visual C++ compiler but then it
didnt work but i see this is the way it is being mentioned in C++
primer by lippman and lajoie.. where is the problem..
Do reply please.
| |
by: wesley |
last post by:
Hi All. i am new to C++. I know that in order to use cout, i need to
include <iostream>. I have done this, but i still get errors when i try
to output to the screen. Is there a file that needs to reside in the
same folder as the project? I know that in java, this is the case.
Please help.
Thank Wesley
|
by: lars.uffmann |
last post by:
Hello everyone!
I just debugged a pretty huge project, eliminating basically every
memory leak that would occur with the current configuration files, at
least according to the mtrace() tool from the library <mcheck.h>.
Now the very last bugs I seem to be incapable of eliminating are:
- 0x000000000061f460 Free 387310 was never alloc'd 0x2aaaab053b53
- 0x000000000061f040 Free 387311 was never alloc'd 0x2aaaab053b53
|
by: Old Wolf |
last post by:
In a discussion elsewhere, someone wrote:
#include <iostreamis not guaranteed to define std::cout, it
merely has to declare it as an extern object, and declarations
of extern objects do not require complete types. As far as I
understand, a implementation is free to use a certain amount
of compiler magic to be able to declare std::cout etc. without
defining basic_ostream.
Is this correct? If so, then it would mean that the following...
|
by: gumboots |
last post by:
Hi there guys, I've recently purchased "Sam's Teach Yourself C++ Fifth Edition" (About a week before the 6th edition came out)
I'm trying to work through the book, but in trying to compile Hello World, I keep getting an error instead of it making the program.
I've looked around the internet for a reason, but come up stuck.
My only assumption would be that the fifth edition is upgraded to suit newer compilers? (I downloaded Visual C++...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |