474,048 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Iostream


it seems when i try to compile this simple code I get an error message i
believe is from g++ not finding the IOSTREAM header file. i found the
header file in /usr/include/c++/3.2.2/ so that is why it is included
like that. suggestions?

I'm running red hat 9

code :

#include </usr/include/c++/3.2.2/iostream>

int main()

{

cout << endl << endl << "Jeff" << endl;

cout << "E115 Sec 010 B" << endl;

cout << "Hello World" << endl << endl << endl;

return 0;

}

errors:

project2.C: In function `int main()':

project2.C:6: `cout' undeclared (first use this function)

project2.C:6: (Each undeclared identifier is reported only once for each

function it appears
--
Posted via http://dbforums.com
Jul 19 '05
13 3436

"ncstate" <me*********@db forums.com> wrote in message
news:35******** ********@dbforu ms.com...

Thanks for the help. the only thing that i seemed to find that worked
was to #include <iostream.h> and it gives me a depreciation message but
compiles and runs fine. is this normal for g++ 3.2.2?? it compiles fine
with #include <iostream> with g++ 2.8.1? should i just keep using the .h
extention and ignore the message?


No.

#include <iostream>

int main()
{
std::cout << "Hello\n";
return 0;
}

-Mike
Jul 19 '05 #11
Mike Wahler wrote:
[snip]
I found this
diagnostic a bit confusing too the first time I saw it.
"'cout' undeclared." Exactly the case. How much more specific
could it be? :-)

Before you say e.g. "well the compiler should 'know' it's a
'namespace std' issue, I'll say that no, it cannot (and should not)
make such an assumption.


I wasn't suggesting that.
OP's problem is not an 'ambiguous' error message, but insufficient
background knowledge before using the compiler.


This is more like it. After years of not using std::, I am sometimes
bewildered when the compiler can't find declarations I know
exist...somewhe re.

/david

--
"As a scientist, Throckmorton knew that if he were ever to break wind in
the echo chamber, he would never hear the end of it."

Jul 19 '05 #12

Thanks for all the help.. Sorry I didn't catch on before. All of the
posts were helpful and appriciated.

Jeff
--
Posted via http://dbforums.com
Jul 19 '05 #13
Mike Wahler wrote:

"MPBroida" <michael.p.broi da@boeing_oops. com> wrote in message
news:3F9858AB.2 DF20187@boeing_ oops.com...
ncstate wrote:

it seems when i try to compile this simple code I get an error message i
believe is from g++ not finding the IOSTREAM header file. i found the
header file in /usr/include/c++/3.2.2/ so that is why it is included
like that. suggestions?

I'm running red hat 9

code :

#include </usr/include/c++/3.2.2/iostream>


It's been a little while, but I seem to recall that
including a file from the "builtin" include dirs is
done via:
#include <filename>
That tells the compiler to use its own include path(s).

But including a USER file is done via:
#include "filename"
That tells the compiler to use the include paths from
the compile commandline (or defaults)(or project/etc).

Try changing the < and > to " and " and see what
happens.


Please check your facts before making such suggestions.


Just looked in my "fact sack" and all looks
well. What facts are you unhappy with?

Mike
Jul 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
89480
by: John Tiger | last post by:
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
19
3867
by: ernst.stiegler | last post by:
Hello, I just want to read a whole line from a console input. What I don't understand is that I always have to press ENTER twice in order to see the line I've entered. Here's my code : #include <string> #include <iostream>
1
3858
by: Pradyot Dhulipala | last post by:
Hi, I am using ns2.26 with the Makefile using C++ compiler version c++ (GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk). When I use iostream.h in a simple program and compile with c++ everything works except I get a deprecated warning. Using the find command I get the location of iostream.h as /usr/include/c++/3.2.2/iostream. Also in my makefile the list of includes are as follows INCLUDES = \
2
4015
by: humble04 | last post by:
Hi, I am compiling a collection of C++ code. Most of them are using the new format #include <iostream>. I think all of them because I failed at finding out which header file uses the old format #include <iostream.h>. However, I met the following error messages. "/usr/vacpp/include/iostream.h", line 74.7: 1540-0400 (S) "class ostream" has a conflicting declaration "../include/myfile.h", line 7.1: 1540-0424 (I) "ostream" is declared on
7
3226
by: S. Nurbe | last post by:
Hi, probably this is a common problem but I couldn't find yet a proper solution (and I hope there is one). I have two relative complex frameworks: one uses only iostream.h the other one only iostream. Is it somehow possible to put them together to one framework and solve the iostream problem (also other header are effected, e.g. fstream)? If I just change the header in one framework I get lots of errors,
1
2941
by: Shane Ragone | last post by:
What happened to iostream.h in VS .NET? Are we now to code: #include <iostream> instead of: #include <iostream.h> All my past code that used iostream.h will no longer
1
4553
by: Bill Sun | last post by:
Hi, I just want to using a console application in the .net enviroment. Before the main(), I using the #include "iostream.h" but the .net tell me: c:\project\console\console\console.cpp(11): fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
1
1368
by: Ly Hoang Hai | last post by:
Hi all, I have just port my C++ 6.0 project into C++ project of Visual Studio.NET. However, .NET tell me that it can not find iostream.h. Some search on the internet tell me that I should change the #include <iostream.h> into #include <iostream>. Because my project is very big, It's very difficult to change like that. Can anyone help me to use <iostream.h> in Visual Studio .NET ?
2
7167
by: NewToCPP | last post by:
I am having some trouble including "iostream" "fstream" to my code. I tried the following ways and base times it did not work. What is the problem? test.cc: ======= ..... #include <iostream.h> #include <fstream.h>
0
10554
marktang
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...
0
10356
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,...
0
11616
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
11146
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10328
agi2029
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...
0
7882
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();...
0
6864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4951
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.