I installed visual studio 2008 a few days ago, but still am unable to compile a simple C++ program. Does anyone have an idea of the changes that have occurred to this version of visual C++, or the new libraries that should be included?
I'm always getting this error:
fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
That's odd. 2008 should come with the deprecated headers.
Try using iostream (without the .h).
Back in 1999, the old *.h headers were deprecated and replaced with extensionless equivalents. Also, the std namespace was created under which all the C++ standard library types and functions are declared. So now it's std::cout, not cout.
Actually, the statement "using namespace" is for declaring the contents of a namespace as part of the global scope, so that you don't have to call that specific namespace before every object contained in it.
For example, if I had a namespace titled "threading," which contained the class "Semaphore," the class would be instanced using:
threading::Semaphore semaphore;
Whereas the declaration of the threading namespace is unnecessary if I declare it as part of the global scope beforehand:
1 2 3 4
usingnamespace Semaphore;
//The inclusion of the scope in which the object is contained is now unnecessary
Semaphore semaphore;
---
the last one permits the usage of the original cout<< instead of the std::cout<<
In reality, both of these are the exact same objects, they're just called in different ways.
Also, "cout" and "<<" are two separate things. "Cout" is an object which prints output to the console using a stream. The operator "<<" is used to differentiate objects in the stream.
For example:
cout << "This is a string object " << /*This is an integer object*/ 9 << /*This is an object which declares a newline character in the stream*/ endl;