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
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
hi,
below is the c++ script which i try to run and its the script tat given me the error.
thanx for the reply -
#include <iostream.h>
-
#include <stdlib.h>
-
#include <time.h>
-
-
// Define the greatest possible value:
-
#define MAX_RANGE 100
-
-
main ()
-
{
-
int counter=0;
-
long value,input;
-
-
srand ( time (NULL) ); // Initialize random generator
-
value = rand()%MAX_RANGE+1; // Get random between 1 and MAX_RANGE
-
-
cout << "\nInsert a value between 1 and " << MAX_RANGE << " : ";
-
-
do {
-
-
cin >> input; // Get user input
-
counter++; // increase attempts counter
-
-
if (value>input) // is value grater than the input?
-
cout << "Value is greater than " << input << ". Try again : ";
-
-
else if (value<input) // if not, is it less?
-
cout << "Value is less than " << input << ". Try again : ";
-
-
else { // else it is the correct number!
-
cout << "That's right! Value was " << input;
-
cout << "\nYou have needed " << counter <<" attempts.";
-
}
-
-
} while (value!=input);
-
return 0;
-
}
-
-
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.
Banfa 9,065
Expert Mod 8TB
Also even if it is C++ main should be -
#include "stdlib.h"
-
-
int main()
-
{
-
// Code statements here
-
-
return EXIT_SUCCESS;
-
}
-
And in deed C++ cource files are not scripts.
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...
Please ignore this post - i submitted half-way through, refer to next post please
As a new programmer (I literally started learning today) I am working on the traditional "Hello World" program, - #include <iostream.h>
-
-
-
int main ()
-
{
-
cout << "Hello World!\n";
-
return 0;
-
}
-
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
Read reply #4, try the code and post your code here if you still have errors.
I tried the code (now looking like this) - #include <stdlib.h>
-
-
-
int main ()
-
{
-
cout<<"Hello World!\n"
-
return 0;
-
}
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?
I don't know why it can't find iostream.h, but your program should be: - #include <iostream>
-
-
using namespace std;
-
-
int main ()
-
{
-
cout<<"Hello World!\n";
-
return 0;
-
}
You need to include iostream, use namespace std, and put a semicolon after the cout.
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...
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?
If you're using Dev-C++, look in Project -> Project Options -> Parameters tab for the arguments your program is passing to the compiler.
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
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.
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...
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.
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...
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.
just to show how noob-ish i am... where are the global settings? also -what version are you using?
Tools -> Compiler Options -> Directories tab.
Ok that worked, there was no problem with iostream, but now the gcc error and such are back... just not my luck eh?
Sign in to post your reply or Sign up for a free account.
Similar topics
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 :
...
|
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...
|
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...
|
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 ...
|
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...
|
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++...
|
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....
|
by: luke.yolanda |
last post by:
I write a simple problem ,as:
******************************
//temp.cpp
#include<iostream.h>
int main(void){
cout<<"123131231";
return 0;
}
|
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...
|
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...
|
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...
|
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...
|
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...
|
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$) {
}
...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |