title: C++ does not name a type in use of classes
body: <p>I want to modify object "t1" of the class "abc" in "update" function which is defined in different file(temp2.cpp) than where "t1" is defined(temp1.cpp). I tried to use extern but that resulted in error. Please suggest nice way of doing this.  </p>
  
  <p>temp1.ccp</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include "test2.cpp"
  
  using namespace std;
  class abc{
    public:
      int x;
      char y;
      void printxy(){
        cout&lt;&lt;x&lt;&lt;y&lt;&lt;endl;
      } 
  };
  
  abc t1;
  int main(){
    update();
  return 0;
  }
  </code></pre>
  
  <p>test2.cpp</p>
  
  <pre><code>extern abc t1;
  void update(){
      t1.x=5;
      t1.y='A';
      t1.printxy();
  };
  </code></pre>
  
  <p>In file included from test.cpp:2:0: test2.cpp:1:8: error: `abc' does not name a type
   extern abc t1;
          ^</p>
  
  <p>test2.cpp: In function `void update()':</p>
  
  <p>test2.cpp:3:2: error: `t1' was not declared in this scope   t1.x=5;  </p>