Thursday, July 30, 2009

Why is Visual Studio 2005 showing this error?

c:\users\ali\documents\visual studio 2005\projects\a diamond\a diamond\stdafx.h(3) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory


OK so i used the 2005 edition but my school uses 6.0 edition. i have school tomorrow and need to run this file.








// outputs an explanation of the name C++





#include %26lt;iostream.h%26gt; //header file needed for input/output





void main() //main function always needed


{


char firstInitial; //user's 1st initial





//tell the story behind the name C++





cout %26lt;%26lt; endl %26lt;%26lt; "You might be curious about the origion of "


%26lt;%26lt; "the name of C++. Well, here's the story."%26lt;%26lt;endl;


cout %26lt;%26lt; "The C programming language became very popular "


%26lt;%26lt; "during the 1980's. C++ extends " %26lt;%26lt;endl;


cout %26lt;%26lt; "C, improving it with new features and support "


%26lt;%26lt; "for a more natural approach to "%26lt;%26lt;endl;


cout %26lt;%26lt; "programming called object-oriented programming "


%26lt;%26lt; " (OOP, for short). The name C++ " %26lt;%26lt;endl;


cout %26lt;%26lt; "refers to C++ for being the next s

Why is Visual Studio 2005 showing this error?
Using g++ compiler, it'll give me a warning if I use:


#include %26lt;iostream.h%26gt;





change it to


#include %26lt;iostream%26gt;





//and change the main function to:


int main()


{


....


//and end it with return 0


return 0;


}





The g++ compiler will give me an error if I use "void main()", so maybe it'll be safer if you do "int main()" coupled with a return value, instead.


No comments:

Post a Comment