title: Error must have class type
body: <p>I'm kinda new in <em>C++</em> and when trying to compile this code I get and error that I do not know how to fix:</p>
  
  <pre><code>int main()
  {
      typedef pair&lt;int,int&gt; nodo;
      int x;
      cin &gt;&gt; x; 
      int *g;                
      g = new int[x];   
  
      vector &lt;nodo&gt; g;
  
  
      g[1].push_back(nodo(2,5));
      g[1].push_back(nodo(3,10));
      g[3].push_back(nodo(2,12));
      g[2].push_back(nodo(4,1));
      g[4].push_back(nodo(3,2));
  
      for (int i = 1; i &lt;=4; ++i){
          //    cout &lt;&lt; i &lt;&lt; " -&gt; ";
          for (int j = 0; j&lt;g[i].size(); ++j){
              //    cout &lt;&lt; g[i][j].first &lt;&lt; " c: " &lt;&lt; g[i][j].second &lt;&lt; " ";    
          }
          //   cout &lt;&lt; endl;
      }
  
      dijkstra(1, x);
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>The error I am receiving is:</p>
  
  <pre><code>Error: Expression must have a class type.
  </code></pre>