Hi Folks:

I just installed Dev-C++ 4.9.7 beta 7 and compiled a simple "Hello World" console app, I get a lot of error related to iostream.h file not being found. Dev-C++ is installed in C:\Dev-Cpp\ directory, Has anyone else have had this problem.

Thanks
AJ

Recommended Answers

All 14 Replies

source code and error log would help, to help you..

> I get a lot of error related to iostream.h file not being found
iostream.h is old C++.

The new way is

#include <iostream>
using namespace std;
int main ( ) { 
    cout << "hello world";
}

Or

#include <iostream>
int main ( ) { 
    std::cout << "hello world";
}

> I get a lot of error related to iostream.h file not being found
iostream.h is old C++.

The new way is

#include <iostream>
using namespace std;
int main ( ) { 
    cout << "hello world";
}

Or

#include <iostream>
int main ( ) { 
    std::cout << "hello world";
}

Here is the Example Code from Dev-C++

#include <iostream.h>
using namespace std;
int
main (int argc, char *argv[])
{
char quit;

quit = '\0';
while (quit != 'q')
{
cout << "Hello ! This is a console app." << endl;
cout << "To create a console, go to Project Options and select" << endl;
cout << "\'Win32 Console\'." << endl;
cout << "Press q to quit " << endl;
cin >> quit;
}

return 0;
}


Here is the Compile error log

22 C:\Dev-Cpp\Examples\Hello\Hello.cpp:1
iostream.h: No such file or directory.

C:\Dev-Cpp\Examples\Hello\Hello.cpp
[Warning] In function `int main(int, char**)':


(Each undeclared identifier is reported only once for each

11 C:\Dev-Cpp\Examples\Hello\Hello.cpp
`endl' undeclared (first use this function)

15 C:\Dev-Cpp\Examples\Hello\Hello.cpp
`cin' undeclared (first use this function)

C:\Dev-Cpp\Examples\Hello\Makefile.win
[Build Error] [Hello.o] Error 1


Something is wrong with Dev-C++


Thanks,
Aj

Rewrite your program in this way :

#include <iostream>
using namespace std;

int main (int argc, char *argv[])
{ 
   char quit = '\0';
   while (quit != 'q')
   {
       cout << "Hello ! This is a console app." << endl;
       cout << "To create a console, go to Project Options and select"     << endl;
       cout << "\'Win32 Console\'." << endl;
       cout << "Press q to quit " << endl;
       cin >> quit;
        }
    getchar ();
    return 0;
}

Copy and paste this code and tell the errors which result.
Hope it helped, bye.

> #include <iostream.h>
> using namespace std;
Nah, just your eyesight :rolleyes:

Hi : Even with #include I get the same errors same case with the above corrected script. It just does not read iostream.h file. I have to cut and paste each error here, I dont think Dev-C++ has a way of exporting all the error messages. 44 C:\Dev-Cpp\include\c++\iostream In file included from C:/Dev-Cpp/include/c++/iostream 1 C:\Dev-Cpp\Mycode\project1.cpp from project1.cpp 29 C:\Dev-Cpp\include\c++\mingw32\bits\c++config.h:34 bits/os_defines.h: No such file or directory. and much more. Believe me the program has no problems, it compiles on Linux. Thanks, AJ

Just not to overlook the obvious, but did you search the directory where you installed Dev-C++ for "iostream" to make sure iostream.h and iostream.cpp are there?

It just does not read iostream.h file.

*Ahem*
Don't #include <iostream.h> .
Do #include <iostream> , and you then should be using namespace std; .

I believe this was mentioned already. Post exactly the code you are using -- subtle typos CAN make a difference.

*Ahem*
Don't #include <iostream.h> .
Do #include <iostream> , and you then should be using namespace std; .

I believe this was mentioned already. Post exactly the code you are using -- subtle typos CAN make a difference.

Hi Folks: Thanks Much, Basically several *.h files are missing in C:\Dev-Cpp\include\c++\bits\ directory foeund in C:\Mingw32\include\c++\bits directory, I just copied all of them. Now it works from Dev-Cpp. I am still unable to compile from command prompt, I have Dev-CPP/bin listed in Enviromnetal in Advanced Menu of system , also all Include & Library files are declared in teh Envirnomentals. Is there a limit to the number of directories that can be listed in PATH? I still get iostream file not found when compiling from command prompt. I like using Emacs better than Dev-Cpp. I need to get some Numenrical Optimization routines written quickly., Is any one familiar with a website that ahas all the math routines to use for Matrices & Vectors etc. Thanks, More in touch with the experts here in the future, hoping get proficient at C++. Thanks, AJ

AJones
Why can't you see what people are telling you?

AJones
Why can't you see what people are telling you?

Hi Folks: my apologies, the code pasted above does work, I use the example Hello.dev from Examples directory soon after installation. How would I get this working from command line. Is anone familiar with any Math C++ source code repository, other than NUmerical Recipes in C++. Thanks, AJ

I solved a problem change .c to .cpp And change iostream.h to iostream
Thanks to everbody.

include <iostream>
include <stdlib.h>
include <time.h>

using namespace std;

//declaraing and initialization integers
int secretNumber = 0,  UserNum=0;
int UpperRange=0 , userMaxRand=0, LowerRange=0;
cout<<"My Student ID Mc140402241 "<<endl;
//Prompt the user to enter upper and lower Range for integers
cout<<"Please Enter Lower Range: ";
cin>>LowerRange;
cout<<"Please Enter Upper Range: ";
cin>>UpperRange;
// loop for exit program if invalid entery of number (if numbers are same or less from Lower Range) and if condition is true it will proceed next
if (UpperRange<=LowerRange)
{
 cout<<"Your Upper Range Must Be Greater Then Lower Range"<<endl;
 }
 else if (LowerRange==UpperRange)
 {
 cout<<"Your Lower Range Must Be Smaller Then Upper Range"<<endl;
 }
 else
 {
cout<<"Computer is calculating a random secret number...";
// Getting maximum number for randomizing from lower and upper Ranges
userMaxRand= UpperRange-LowerRange;
srand(time(NULL)); // This will ensure a really randomized number by help of time
// Randomizing the number
secretNumber = rand()% userMaxRand+LowerRange;
 //On finishing randomiz number
cout<<"Done!"<<endl<<endl;
//Prompt the user to enter Guessing Number
cout<<"Please guesss the secret number in the range ["<<LowerRange<<" - "<<UpperRange<<" ]: ";
cin>>UserNum;
//Loop for compairing User guessing number with secretNumber of program
if(UserNum > secretNumber){
    cout<<"Oooppssss...your entered number is too high...Computer won"<<endl;
}    
else if(UserNum < secretNumber){
    cout<<"Oooppssss...your entered number is too low...Computer won"<<endl;
}         
else if(UserNum == secretNumber) {
    cout<<"Wawoooo...Congratulations!...You won"<<endl;
}    
else{
    cout<<"Invalid Input"<<endl;        
}    
cout<<"\n\nSecret Number was: "<<secretNumber<<endl<<endl;

system("pause");
 }

File error occures (Source file not compiled)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.