473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

simple program fails ???

Hi,

I try to compile the following with Visual Studio.NET

#include <iostream.h>
void main()
{
cout << "test";
}

but I get a compiler error : "Cannot open include file: 'iostream.h': No
such file or directory."

Then I try :

#include <iostream>
void main()
{
cout << "test";
}

but then I get error : "'cout' : undeclared identifier"

how do I fix this ?

thank you
Chris

Nov 17 '05 #1
2 846
Use :-

std::cout

or put :-

using namespace std ;

on top of your src code.

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
"Chris" <ch********@pandora.be> wrote in message
news:A%*******************@phobos.telenet-ops.be...
Hi,

I try to compile the following with Visual Studio.NET

#include <iostream.h>
void main()
{
cout << "test";
}

but I get a compiler error : "Cannot open include file: 'iostream.h': No
such file or directory."

Then I try :

#include <iostream>
void main()
{
cout << "test";
}

but then I get error : "'cout' : undeclared identifier"

how do I fix this ?

thank you
Chris

Nov 17 '05 #2
Chris wrote:
Hi,

I try to compile the following with Visual Studio.NET

#include <iostream.h>
void main()
{
cout << "test";
}

but I get a compiler error : "Cannot open include file: 'iostream.h': No
such file or directory."

Then I try :

#include <iostream>
void main()
{
cout << "test";
}

but then I get error : "'cout' : undeclared identifier"

how do I fix this ?

The proper ISO C++ code is:
#include <iostream>

int main()
{
std::cout << "test";
}


--
Ioannis Vranos
Nov 17 '05 #3

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

Similar topics

3
by: Gavin Bauer | last post by:
My DOS window (running in windows ME) closes the second it finishes running my programs. As you can imagine, this makes it hard to see the results. I've gotten in the habit of putting...
38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
7
by: Zack Wahab | last post by:
Hi, I use Dev C++ compiler. Tried this program : // Fig. 1.6: fig01_06.cpp // Addition program. #include <iostream> // function main begins program execution int main()
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.