title: 'undefined reference' with 'not declared'
body: <p>this is a simple problem in c compiling and linking. But I want to discuss the principle of compiler and linker.</p>
  
  <pre><code>void f();
  int main()
  {
      f();
  }
  </code></pre>
  
  <p>this code receive error message "undefined reference to 'f()'"</p>
  
  <pre><code>int main()
  {
      f();
  }
  </code></pre>
  
  <p>this code receive error message "f was not declared in this scope"
  what is the difference?
  and what 's more,  the code</p>
  
  <pre><code>void f()
  {
  
  }
  int main()
  {
      f();
  }
  </code></pre>
  
  <p>runs well.</p>