title: Function not declared in scope / How use header.h, header.cpp, and main.cpp together?
body: <p>I'm a complete beginner in C++ and I'm having trouble getting my functions declared in the <code>header.h</code> file, defined in <code>header.cpp</code>, and called in <code>main.cpp</code>. I've been looking for solutions but nothing I do seems to work. I would appreciate some input on how I can fix these issues.</p>
  
  <p>Here's my code:</p>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "DLinkedList.h"
  
  int main() {
    getInfo(); //Running my function getInfo
  }
  </code></pre>
  
  <p><strong>DLinkedList.h</strong></p>
  
  <pre><code>#ifndef DLINKEDLIST_H
  #define DLINKEDLIST_H
  
  class Node
  {
    private:
        int info;
  
    public:
         Node* prev;
         Node* next;
         int getInfo(); //Declaring my function getInfo
         void setInfo(int value); 
  };
  #endif
  </code></pre>
  
  <p><strong>DLinkedList.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "DLinkedList.h"
  
  int getInfo() { //Defining my function getInfo
    int answer;
    std::cout &lt;&lt; "Input the integer you want to store in the node: ";
    std::cin &gt;&gt; answer;
    return answer;
  }
  </code></pre>
  
  <p>And the error message:</p>
  
  <pre><code>exit status 1
  main.cpp: In function 'int main()':
  main.cpp:6:3: error: 'getInfo' was not declared in this scope
     getInfo();
     ^~~~~~~
  </code></pre>