title: Id returned 1 exit status error
body: <p>I have been trying to figure out this error for almost an hour and am having trouble. I was reading this post: <a href="https://stackoverflow.com/questions/17717946/c-compile-error-id-returned-1-exit-status">C compile error: Id returned 1 exit status</a> and someone said that it could be because the program is still running. I have checked that and it is not running and I still get the error. </p>
  
  <p>This is what the error looks like: C:\Program\collect2.exe  [Error] ld returned 1 exit status. </p>
  
  <p>I also looked at some more posts with answers such as this one: <a href="https://stackoverflow.com/questions/37634384/id-returned-1-exit-status-error-in-my-c-program">Id returned 1 exit status error in my C program</a> and the top response was that it was a "linker error" and that the program is getting complied incorrectly. I tried creating a new project and copying the code but end up with the same error. I then went into the compiler options and I took a screenshot of the options. Do these options look okay? </p>
  
  <p><a href="https://i.stack.imgur.com/p2c13.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p2c13.png" alt="enter image description here"></a></p>
  
  <p>Maybe its just an error in my code I am overlooking. I have to create a tail recursion function to add numbers. For example the user enters 4 and the function adds 4+3+2+1 to get 10.</p>
  
  <p>I believe the error is in this piece of code in the while loop: </p>
  
  <pre><code>else{
  
          printf("Answer = %d \n", addNum(num));  
      }
  </code></pre>
  
  <p>When I comment that out I can run it and enter negative numbers or zero and get the output.If my program is off as in the function wont output correctly I do not want you to correct it. I will tweak that stuff later and figure the answer out for myself,  I am just looking for why I am getting this error. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int addNum(int n);
  int main(int argc, char *argv[]) {
  
      int num;
      int count = 1;
  
  
      printf("Enter an integer greater than zero, (q to quit): \n");
  
  
      while(count &lt; 3){
  
          printf("Enter a positive number: \n");
          scanf("%d", &amp;num);
  
          if(num &lt; 0){
  
              printf("Enter a positive number: \n");
          }
          else if(num == 0){
  
              printf("Answer = 0 \n");
          }
          else{
  
              printf("Answer = %d \n", addNum(num));  
          }
  
  
       }
  
  
      int addNum(int n){
  
         int answer; 
  
         if(n &gt; 0){
  
            answer = n += addNum(n - 1);  
         }
         return answer;
      }
  
     return 0;
    }
  </code></pre>