C++ compilation error: ‘pair’ does not name a type
<p>I'm trying to compile very simple c++ program by g++ compiler.</p>

<pre><code>//main.cpp 

#include &lt;stdio.h&gt;

using namespace std;

typedef pair&lt;int,int&gt; pii;

int main(int argc, char *argv[])
{
    printf("Hi");
    return 0;
}
</code></pre>

<p>But I'm getting compilation error: ‘pair’ does not name a type</p>

<p>Compile line: g++ main.cpp -o main.out
OS: Ubuntu 16.04 lts
g++: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2) </p>

<p>If I just add <code>#include&lt;iostrem&gt;</code> program compiles and runs successfully:)</p>

<pre><code>#include &lt;stdio.h&gt;
#include&lt;iostream&gt;

using namespace std;

typedef pair&lt;int,int&gt; pii;

int main(int argc, char *argv[])
{
    printf("Hi");
    return 0;
}
</code></pre>

<p>Do you know, why is this happens?</p>