RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 2419 | Replies: 6
Reply
Join Date: Sep 2004
Posts: 20
Reputation: dcving is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
dcving's Avatar
dcving dcving is offline Offline
Newbie Poster

Help .h file not found?

  #1  
Sep 30th, 2004
// 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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2004
Location: Boston,MA
Posts: 1,362
Reputation: mikeandike22 is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 17
Featured Blogger
mikeandike22's Avatar
mikeandike22 mikeandike22 is offline Offline
Nearly a Posting Virtuoso

Re: .h file not found?

  #2  
Sep 30th, 2004
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.
My Daniweb Blog: This,That, and Everything Else (Blog contest winner)

GetFirefox!
GetOpera!






Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,032
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 33
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: .h file not found?

  #3  
Sep 30th, 2004
Try #include<iostream> instead of iostream.h
Not sure if that will definitely work, but supposedly it's the new standard.
Dani the Computer Science Gal
Reply With Quote  
Join Date: Sep 2004
Location: Overflow State
Posts: 183
Reputation: Stack Overflow is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 4
Stack Overflow's Avatar
Stack Overflow Stack Overflow is offline Offline
C Programmer

Re: .h file not found?

  #4  
Sep 30th, 2004
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
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
Reply With Quote  
Join Date: May 2004
Location: Boston,MA
Posts: 1,362
Reputation: mikeandike22 is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 17
Featured Blogger
mikeandike22's Avatar
mikeandike22 mikeandike22 is offline Offline
Nearly a Posting Virtuoso

Re: .h file not found?

  #5  
Sep 30th, 2004
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.
My Daniweb Blog: This,That, and Everything Else (Blog contest winner)

GetFirefox!
GetOpera!






Reply With Quote  
Join Date: Sep 2004
Posts: 20
Reputation: dcving is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
dcving's Avatar
dcving dcving is offline Offline
Newbie Poster

Help Re: .h file not found?

  #6  
Oct 1st, 2004
i tried iostream without .h...and i get even more fatal errors...i guess i should reload?
Reply With Quote  
Join Date: Sep 2004
Posts: 6,565
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 31
Solved Threads: 497
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: .h file not found?

  #7  
Oct 1st, 2004
>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.
I'm here to prove you wrong.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:29 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC