943,498 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 5172
  • C++ RSS
Sep 30th, 2004
1

.h file not found?

Expand Post »
// 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?
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
dcving is offline Offline
20 posts
since Sep 2004
Sep 30th, 2004
1

Re: .h file not found?

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.
Reputation Points: 33
Solved Threads: 19
Nearly a Posting Virtuoso
mikeandike22 is offline Offline
1,496 posts
since May 2004
Sep 30th, 2004
0

Re: .h file not found?

Try #include<iostream> instead of iostream.h
Not sure if that will definitely work, but supposedly it's the new standard.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Sep 30th, 2004
0

Re: .h file not found?

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
Reputation Points: 26
Solved Threads: 4
Junior Poster
Stack Overflow is offline Offline
185 posts
since Sep 2004
Sep 30th, 2004
0

Re: .h file not found?

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.
Reputation Points: 33
Solved Threads: 19
Nearly a Posting Virtuoso
mikeandike22 is offline Offline
1,496 posts
since May 2004
Oct 1st, 2004
0

Re: .h file not found?

i tried iostream without .h...and i get even more fatal errors...i guess i should reload?
Reputation Points: 11
Solved Threads: 0
Newbie Poster
dcving is offline Offline
20 posts
since Sep 2004
Oct 1st, 2004
0

Re: .h file not found?

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How to create a dll in symbian os using C++?
Next Thread in C++ Forum Timeline: how interrupts work in c/c++





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC