All confused.

Ok , i just installed Visual Studio 2008.
As i followed through some tutorials on how to write a console applications , i did the same.

File --> New Project --> Empty Project --> Then Right Click on the source folder in the solution explorer ---> Add a new item --> Add *.cpp file.

Now i wrote this code to test as usual.

#include <iostream>
using namespace std;

int main()
{
cout << "Hello World!";
return 0;
}

I get this error: error C2065: 'cout' : undeclared identifier.

I'm totally confused ..... What could be the problem ?
That is, indeed, very strange. There is nothing wrong with that code at all. It should compile and run just fine (I just copy-pasted that and triple-checked on my machine and it works fine over here).

Maybe it's some weird VS setting. When you created your new project, was there a setting to select whether or not it was a console program? Make sure you have that selected if there is such an option. Other than that I don't know what could be wrong.
Hmm... Perhaps he created a C# project and not a C++ project?
I created a c++ project and selected console application. Even i'm very confused. I'm not able to gauge out whats wrong ?

This is the problem:

1>------ Build started: Project: tikiwiki, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>e:\program files\microsoft visual studio 9.0\vc\include\iostream(53) : warning C4091: 'extern __declspec(dllimport)' : ignored on left of 'std::basic_ostream<_Elem,_Traits>' when no variable is declared
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1>d:\documents and settings\vips\my documents\visual studio 2008\projects\tikiwiki\tikiwiki\main.cpp(6) : error C2065: 'cout' : undeclared identifier
1>Build log was saved at "file://d:\Documents and Settings\Vips\My Documents\Visual Studio 2008\Projects\tikiwiki\tikiwiki\Debug\BuildLog.htm"
1>tikiwiki - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited on
I think it's a hosed installation. Something probably went wrong during the installation. I would just reinstall the IDE and see if that helps.
You need to create a Win32 Console Application, the choose Empty project to avoid the inclusion of stdafx.*.
Helios , i think , i should do the same , reinstall the stuff.

@kbw , i created Win32 Console Application and started of with the empty project itself.
I even tried by unchecking the Predefined Headers.

I think the last resort to all this stuff is: Reinstalling.

And yea , one thing more. Actually , i haven't installed Visual Studio in my root directory.
Since my root directory has a very less space left. Maybe that could trigger the problem ?
More over it does install some extra files into the root.
So i think , i need to run a disk clean up ?
Actually my D: Drive is the root drive.

Regards.
VS installs anywhere. The location shouldn't matter, as long as it's installed and not copied.

You could use the menu: Tools->Options->Projects and Solutions->VC++ Directories. Then select "Include files" and check that the paths point to the C++ header files.
Hey! Kbw , well , thanks for the prompt reply. But since many days i was finding my O/S behaving very unusual. Even the partitions i made the last time were nonsense. So i decided to re-install my O/S since many programs weren't working as they generally do.

Finally i re-installed my O/S and yea , i'm now going to install VISUAL STUDIO 2008! Hope there will not be any problem such that. If it still persists i will definitely try your way out!

Regards.
Topic archived. No new replies allowed.