Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cout is not a member of std

Tags:

c++

io

std

cout

member

People also ask

Is cout an STD?

std:cout: A namespace is a declarative region inside which something is defined. So, in that case, cout is defined in the std namespace.

Do you need STD for cout?

How can we use cout with and without using 'std::'? cout and std::cout both are same, but the only difference is that if we use cout, namespace std must be used in the program or if you are not using std namespace then you should use std::cout.

Can we use cout in class in C++?

The cout object in C++ is an object of class ostream. It is defined in iostream header file. It is used to display the output to the standard output device i.e. monitor. It is associated with the standard C output stream stdout.

Is Endl a namespace std?

cout is a global object defined in the std namespace, and endl is a (stream manipulator) function also defined in the std namespace.


add #include <iostream> to the start of io.cpp too.


Also remember that it must be:

#include "stdafx.h"
#include <iostream>

and not the other way around

#include <iostream>
#include "stdafx.h"

I had a similar issue and it turned out that i had to add an extra entry in cmake to include the files.

Since i was also using the zmq library I had to add this to the included libraries as well.