-4

I am using visual studio 2013 to build a C++ console application.This is my code which gives an error. I need to write to the console for every function in my application.

// RAT.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    std::cout << "Process started";
    return 0;
}

It gives the following error,

Error:namespace "std" has no member "cout"

I dont understand why this basic "cout" gives a such error :( Please help me I am totally confused....

drescherjm
  • 10,365
  • 5
  • 44
  • 64

1 Answers1

3

You need to place #include <iostream> as your header.

  • I did that too but it did not work. But after I restart visual studio it worked. Thank you all :) – The Architect Nov 06 '16 at 05:00
  • _@Djerdjer_ Your answer is neither correct (should be `#include`), nor even complete (you missed to explain it should be `std::cout`). – πάντα ῥεῖ Nov 06 '16 at 10:31
  • @πάνταῥεῖ, he is already including "stdafx.h", so I guess he knows how to include headers using #, but you are right I should have put # (because the sample might be generated automatically from visual studio template). In regard to std::cout, he is already using it. –  Nov 06 '16 at 13:17