Monday, May 24, 2010

My Microsoft Visual C++ 2005 is not working right?

My Microsoft Visual C++ 2005 Studio is not working well because on a Win32 Console Application, when I type the code





#include %26lt;iostream%26gt;





main()


{


std::cout %26lt;%26lt; "some text" %26lt;%26lt; std::endl;


}





it gives me the following error:





------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------


Compiling...


HelloWorld.cpp


c:\programming\cppprojects\helloworld\... : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


Build log was saved at "file://c:\Programming\cppprojects\Hello...


HelloWorld - 1 error(s), 0 warning(s)


========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========





I'm trying to learn some C++ but this is making it impossible. Please help me as soon as possible, THANK YOU VERY MUCH!

My Microsoft Visual C++ 2005 is not working right?
#include %26lt;iostream%26gt;





int main ()


{


cout %26lt;%26lt; "Hello World!";


return 0;


}
Reply:You don't have a specified return type. You can use





void main()





but this is nonstandard. Returning an int is actually the standard, like this:





http://xoax.net/comp/cpp/console/Lesson1...





Microsoft does (or used to) support a void return type. The standard does not. So, a void return type is not portable.


No comments:

Post a Comment