| | |
.h file not found?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
// Program 2.25: Distance an object travels in miles
// and time it takes to travel that distance
// Author: Eric Martin
// Date: 9/30/2004
#include <iostream.h>
using namespace std;
int main()
{
int distanceInMiles;
int speedInMPH;
int timeInMinutes;
cout << "Computes time to travel given distance and speed" << endl;
cout << "Enter distance in miles: ";
cin >> distanceInMiles;
cout << "Enter speed in miles per hour: ";
cin >> speedInMPH;
timeInMinutes = distanceInMiles * 60 / speedInMPH;
cout << "It takes " << timeInMinutes << " minutes to travel "
<< distanceInMiles << " miles at "
<< speedInMPH << " miles per hour" << endl;
return 0;
}
When I build the program in Visual Studio..it comes up with fatal error: unable to locate .h file or somethin...wtf?
// and time it takes to travel that distance
// Author: Eric Martin
// Date: 9/30/2004
#include <iostream.h>
using namespace std;
int main()
{
int distanceInMiles;
int speedInMPH;
int timeInMinutes;
cout << "Computes time to travel given distance and speed" << endl;
cout << "Enter distance in miles: ";
cin >> distanceInMiles;
cout << "Enter speed in miles per hour: ";
cin >> speedInMPH;
timeInMinutes = distanceInMiles * 60 / speedInMPH;
cout << "It takes " << timeInMinutes << " minutes to travel "
<< distanceInMiles << " miles at "
<< speedInMPH << " miles per hour" << endl;
return 0;
}
When I build the program in Visual Studio..it comes up with fatal error: unable to locate .h file or somethin...wtf?
i have the same prob with dev c++ i couldn't figure out how to fix it. Try just doing a reinstall. This is such annoying problem too because most programs are made with iostream header file.
Try #include<iostream> instead of iostream.h
Not sure if that will definitely work, but supposedly it's the new standard.
Not sure if that will definitely work, but supposedly it's the new standard.
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
I agree with cscgal,
I have stated this time and time again:
The difference between iostream and iostream.h (summary)
You should avoid using the *.h version as much as possible, because some implementations have bugs in their *.h version. Moreover, some of them support non-standard code that is not portable, and fail to support some of the standard code of the STL.
Furthermore, the *.h version puts everything in the global namespace. The extension-less version is more stable and it's more portable. It also places everything in the std namespace.
iostream.h is an old style method of including std C++ headers, and in opposite to iostream you don't have to declare that you're using the std namespace.
As cscgal stated, #include <iostream> without the *.h may solve the issue.
- Stack Overflow
I have stated this time and time again:
The difference between iostream and iostream.h (summary)
You should avoid using the *.h version as much as possible, because some implementations have bugs in their *.h version. Moreover, some of them support non-standard code that is not portable, and fail to support some of the standard code of the STL.
Furthermore, the *.h version puts everything in the global namespace. The extension-less version is more stable and it's more portable. It also places everything in the std namespace.
iostream.h is an old style method of including std C++ headers, and in opposite to iostream you don't have to declare that you're using the std namespace.
As cscgal stated, #include <iostream> without the *.h may solve the issue.
- Stack Overflow
Following the rules will ensure you get a prompt answer to your question. If posting code, please include BB [code][/code] tags. Your question may have been asked before, try the search facility.
IRC
Channel: irc.daniweb.com
Room: #c, #shell
IRC
Channel: irc.daniweb.com
Room: #c, #shell
that solved it for me thanks dani. There is no more errors when i compile it using because of that i still have some bugs to tweak with dev c++ but im not sure if i downloaded the beta or not. Sorry about tagging your problem.
>i tried iostream without .h...and i get even more fatal errors...i guess i should reload?
No, you should consider namespaces. An easy fix is to say using namespace std; after you include all of your headers. This isn't the best fix, but it is quick and usually works if you don't have other errors.
No, you should consider namespaces. An easy fix is to say using namespace std; after you include all of your headers. This isn't the best fix, but it is quick and usually works if you don't have other errors.
I'm here to prove you wrong.
![]() |
Similar Threads
- Help me plz File not Found yet file is there (Pascal and Delphi)
- fatal error C1075: end of file found before the left brace '{' at 'c:\documents and s (C++)
- "run time error 53" file not found (Visual Basic 4 / 5 / 6)
- vb6- dll file not found? (Visual Basic 4 / 5 / 6)
- Included file not found during compile time. (C++)
- Registry file was not found (Windows 95 / 98 / Me)
- Dani Web 404 Error File Not Found (DaniWeb Community Feedback)
- File Not Found (DaniWeb Community Feedback)
- TChart - [Fatal Error] File not found: TeeConst.pas (Pascal and Delphi)
Other Threads in the C++ Forum
- Previous Thread: How to create a dll in symbian os using C++?
- Next Thread: how interrupts work in c/c++
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






