title: How to call a function from a separate cpp file in the main.cpp file?
body: <p>I have the following Timer.cpp, Timer.h, and main.cpp files. I am trying to call functions from the Timer.cpp file in my main.cpp file and have included the Timer.h in the main, but it is still not working. Can someone please explain why? I am a little rusty with C++ and feel like I am making a silly mistake. Thanks in advance for any help.</p>
  
  <pre><code>#Timer.h file
  
  #ifndef __Notes__Timer__
  #define __Notes__Timer__
  
  #include &lt;iostream&gt;
  
  class Timer {
  public:
      Timer();
      void start();
      void stop();
      void clear();
      float getDelta();
  };
  
  #endif
  </code></pre>
  
  <hr>
  
  <pre><code>#Timer.cpp file    
  #include "Timer.h"
  
  
  clock_t startTime;
  clock_t stopTime;
  
  Timer::Timer(){
      startTime = 0;
      stopTime = 0;
  }//Timer
  
  void start(){
      startTime = clock();
  }//start
  
  void stop(){
      stopTime = clock();
  }//stop
  
  float getDelta(){
      return stopTime-startTime;
  }//getDelta
  </code></pre>
  
  <hr>
  
  <pre><code>#main.cpp file
  
  #include "Timer.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  
  int main(){
      char quit;
      start();
      cout &lt;&lt; "Would you like to quit? Y or N: ";
      cin &gt;&gt; quit;
      if (quit != 'Y' || quit != 'y'){
          while (quit != 'Y' || quit != 'y'){
              cout &lt;&lt; "Would you like to quit? Y or N: ";
              cin &gt;&gt; quit;
          }//while
      }//if
      else {
          stop();
          cout &lt;&lt; getDelta();
          exit(0);
      }//else
  }//main
  </code></pre>