473,383 Members | 1,859 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,383 software developers and data experts.

iostream.h problem

Hi,

i'm a c++ nub, i got a simple file in.cpp which i uses .net to compile but it gives me an error:

"fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory".

may i noe where do i get the iostream.h file so tat i can attach it to the header.

THX =P
Jul 28 '06 #1
22 31107
Banfa
9,065 Expert Mod 8TB
Should just be a case of making sure you have the include path to iostream.h in your compiler include paths.

iostream.h should have been distributed with Visual Studio
Jul 28 '06 #2
hi,

below is the c++ script which i try to run and its the script tat given me the error.

thanx for the reply


Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. // Define the greatest possible value:
  6. #define MAX_RANGE 100
  7.  
  8. main ()
  9. {
  10.   int counter=0;
  11.   long value,input;
  12.  
  13.   srand ( time (NULL) );         // Initialize random generator
  14.   value = rand()%MAX_RANGE+1;    // Get random between 1 and MAX_RANGE
  15.  
  16.   cout << "\nInsert a value between 1 and " << MAX_RANGE << " : ";
  17.  
  18.   do {
  19.  
  20.     cin >> input;                // Get user input
  21.     counter++;                   // increase attempts counter
  22.  
  23.     if (value>input)             // is value grater than the input?
  24.       cout << "Value is greater than " << input << ". Try again : ";
  25.  
  26.     else if (value<input)        // if not, is it less?
  27.       cout << "Value is less than " << input << ". Try again : ";
  28.  
  29.     else {                       // else it is the correct number!
  30.       cout << "That's right! Value was " << input;
  31.       cout << "\nYou have needed " << counter <<" attempts.";
  32.       }
  33.  
  34.   } while (value!=input);
  35.   return 0;
  36. }
  37.  
  38.  
Jul 29 '06 #3
dna5122
12
Several things to note here. You mentioned .NET - did you create this project as a .NET project or as a console application? It should be a console appliation. I guess you just meant you are using Visual Studio.NET.

I don't know about the latest versions of C++ from MS but the .h header files have been deprecated for quite some time and could have been removed. Somehow I doubt they'll ever stop shipping the old .h files as that would break backwards compatibility. Although Banfa is probably right, I wonder how that include directory could have been dropped?

You could also try dropping the .h extension on all header files that you didn't create yourself like this:
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
// Define the greatest possible value:
#define MAX_RANGE 100
...

Oh, please don't ever call C++ programs 'scripts', ever.
Jul 29 '06 #4
Banfa
9,065 Expert Mod 8TB
Also even if it is C++ main should be

Expand|Select|Wrap|Line Numbers
  1. #include "stdlib.h"
  2.  
  3. int main()
  4. {
  5.   // Code statements here
  6.  
  7.   return EXIT_SUCCESS;
  8. }
  9.  
And in deed C++ cource files are not scripts.
Jul 29 '06 #5
Hi. I have the same problem: *unable to open include file 'IOSTREAM.H'*
I've checked the path - the file is there. I'm curious to find out what's the problem.
I've also tried without '.h'. Nothing changed...
Aug 28 '08 #6
Please ignore this post - i submitted half-way through, refer to next post please
Oct 1 '08 #7
As a new programmer (I literally started learning today) I am working on the traditional "Hello World" program,

Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2.  
  3.  
  4. int main ()
  5. {
  6.     cout << "Hello World!\n";
  7.         return 0;
  8. }
  9.  
and unfortunately I am coming up with the same error, and when I try without the ".h" extension I receive even more errors ranging from
iostream: No such file or directory. and `cout' undeclared (first use this function) to
L2310 (W) Undefined external symbol "PegAppInitialize(PegPresentationManager *)" referenced in "cppeg_add"

All I really need is a way to get around the iostream problem, and i am wondering if a few things might work...
1) Try to program on an XP system, it may be a Vista thing
2) Find an alternate file to use
3) See if my code is a little off (in that case i will find a better guide)...

If you could back me up (as in check my work and possibly tell me if one (or all) of the solutions are worthless i would appreciate it greatly
Oct 1 '08 #8
r035198x
13,262 8TB
Read reply #4, try the code and post your code here if you still have errors.
Oct 1 '08 #9
I tried the code (now looking like this)

Expand|Select|Wrap|Line Numbers
  1. #include <stdlib.h>
  2.  
  3.  
  4. int main ()
  5. {
  6.     cout<<"Hello World!\n"
  7.     return 0;
  8. }    
and according to the error messages there are no problems on any line, however there are still the errors of
[C3305 (F) Invalid command parameter "LC \PROGRA~1\Dev-Cpp\lib"] and
a GCC error of [cannot specify -o with -c or -S and multiple compilations]
thankyou for pointing out that post to me, but do you have any ideas about this?
Oct 2 '08 #10
boxfish
469 Expert 256MB
I don't know why it can't find iostream.h, but your program should be:
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     cout<<"Hello World!\n";
  8.     return 0; 
  9. }
You need to include iostream, use namespace std, and put a semicolon after the cout.
Oct 2 '08 #11
Thanks (i didnt see the semi-colon bit, it must've slipped my mind) however that doesnt work either - even tried using iostream.h and stdlib.h instead but none of them works... I'm going to get on the XP computer and see if that fixes the problem... Oh, and in case you were wondering the errors are the exact same two...

[C3305 (F) Invalid command parameter "LC \PROGRA~1\Dev-Cpp\lib" ]
GCC ERRORS
[cannot specify -o with -c or -S and multiple compilations]

Thanks for your input though...
Oct 2 '08 #12
newb16
687 512MB
I[C3305 (F) Invalid command parameter "LC \PROGRA~1\Dev-Cpp\lib"] and
a GCC error of [cannot specify -o with -c or -S and multiple compilations]
thankyou for pointing out that post to me, but do you have any ideas about this?
So what do you run in case of gcc - I mean command line arguments? Did you try to look at command line and find what causes the problem?
Oct 2 '08 #13
boxfish
469 Expert 256MB
If you're using Dev-C++, look in Project -> Project Options -> Parameters tab for the arguments your program is passing to the compiler.
Oct 2 '08 #14
Thanks for all that... for some reason Dev-C++ doesn't like 'cout', it worked fine yesterday, but today and on Wednesday it doesn't know what the cout command is ("cout undefined" etc.)...
I have a feeling I just got a crappy version (I originally found it while looking for programs to run on my calculator (Classpad 330), and i found "CASIO SDK" using Dev-C++ as a basis to work from... I was really excited when i read the description for SDK, as I thought this is perfect to learn C++, but i have a feeling that the Dev-C++ has been modified dramatically (even when run without the SDK)

I checked in the Parameters tab and nothing is being passed (the whole thing is blank (probably the problem) thought this might be how im running the program... at start of a project it asks the question "What will the format be?", Classpad file, Windows file, Classpad and Windows, Blank. I have been choosing blank as the other two just fill up the first page with automatically written code
Oct 2 '08 #15
Laharl
849 Expert 512MB
In order to utilize "cout" as "cout", you need to have the line "using namespace std;" (semicolon matters) at the top of your file near the includes. Otherwise, you need to declare "cout" as "std::cout". As to the iostream issues, I'm not sure if Dev-C++ actually comes with the headers. I know they're not installed by default on Windows...Not entirely sure, though.
Oct 3 '08 #16
even using namespace std; doesn't do anything, the old GCC error just keeps popping up, and i found it wasnt a compatibility problem as i hoped, for the same problems occur on XP...
Oct 3 '08 #17
Laharl
849 Expert 512MB
Search your computer for iostream.h, looking in hidden files and folders and system files and folders (options in the Windows search dialog). If nothing appears, then you need to install the header files.
Oct 3 '08 #18
I've found It (was in a folder containing Dev-C++ [C:\Program Files\Dev-Cpp\include\c++\backward]) and now i just want to know how do i get the program to find it? Dev-C++ obviously knows where it is, but wont search there...
Oct 4 '08 #19
Laharl
849 Expert 512MB
Somewhere in Dev-C++, there should be an option to set include paths (I've never used it, but look for something like Global Options/Tools->Options, Preferences, etc). Make sure that folder is in the list. If that doesn't work...I'm out of ideas, short of switching compilers.
Oct 4 '08 #20
just to show how noob-ish i am... where are the global settings? also -what version are you using?
Oct 4 '08 #21
boxfish
469 Expert 256MB
Tools -> Compiler Options -> Directories tab.
Oct 4 '08 #22
Ok that worked, there was no problem with iostream, but now the gcc error and such are back... just not my luck eh?
Oct 4 '08 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

19
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 : ...
1
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...
20
by: Mark | last post by:
I am using gnu g++ version 3.3.2, trying a simple test to read in and then write out a large (100,000 line) text file ########################################## CSTDIO VERSION TO READ/WRITE...
2
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 ...
7
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...
13
by: Winbatch | last post by:
Hi, If this should be directed to another group, please let me know... I've been working with templates for a few weeks and have been able to develop some nice code on solaris using the Forte C++...
2
by: sg10241024 | last post by:
Hello, I included the header "iostream" Why is there only the possiblity of including #include<iostream>? From Visual C++ 6 I know the iostream.h. The name doesnt't really interest me....
4
by: luke.yolanda | last post by:
I write a simple problem ,as: ****************************** //temp.cpp #include<iostream.h> int main(void){ cout<<"123131231"; return 0; }
1
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...
12
by: NOO Recursion | last post by:
Hi everyone! I am trying to write a program that will search a 12x12 for a thing called a "blob". A blob in the grid is made up of asterisks. A blob contains at least one asterisk. If an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.