title: undefined reference to `scanf_s'
body: <p>I've got a piece of coursework to get done quickly which requires me to be able to debug the code in a certain way. In order to complete the assignment I have to be able to run the program I've been given and use breakpoints to guide the program step by step. The program we have been given is a basic view of an ATM and has a number of errors.</p>
  <p>Please don't fix the errors in the code, but can someone please tell me what I can do about the errors I'm receiving in relation to the <code>scanf_s</code> lines as I keep getting the error '<em>undefined reference to <code>scanf_s</code></em>' The code is as follows:</p>
  <pre><code>/* This program has been altered purposefully
     so that it contains problems.
     Use the program to complete P2-Debugging a program
     Remember to take screenshots of you do the following:
  
     Adding a breakpoint at an appropriate point
     Stepping into functions (F11) and over each line of code (F10)
     Changing variables and altering other code, e.g. changing messages
     Watching the values of variables.
     Add comments to the code before taking screenshots.
     Fix the problems if you can. Otherwise, just add comments to the code
     indicating where you think the problems are and what the solution might be.
     Place all evidence into one Word Document and submit it.
     Can you add other improvements?
  */
  #include &lt;stdio.h&gt;
  
  int getOption()
  {
      int option = 0, nl;
      printf(&quot;\nWelcome to the ATM\n&quot;);
  
      printf(&quot;\nMenu\n&quot;);
      printf(&quot;\n1. Withdraw Cash\n&quot;);
      printf(&quot;\n2. Show Balance\n&quot;);
      printf(&quot;\n3. Exit\n&quot;);
      printf(&quot;\nEnter a number from 1 to 3:&quot;);
      option = scanf_s(&quot;%d%c&quot;, &amp;option, &amp;nl);
  
      return option;
  }
  
  //function to allow you to withdraw cash
  int withdrawCash()
  {
      float amount;
      int nl, option;
  
      printf(&quot;\nHow much money do you want?&quot;);
      amount = scanf_s(&quot;%d%c&quot;, &amp;option, &amp;nl);
      return option;
  }
  
  //function to show you your balance
  int getBalance()
  {
      float balance = 10000;
      int nl, option;
  
      printf(&quot;\nHow much money do you want?&quot;);
      balance = scanf_s(&quot;%d%c&quot;, &amp;option, &amp;nl);
      return balance;
  }
  
  //function to update your balance
  int updateBalance(float balance, float amount)
  {
      int nl, option;
      balance = balance - amount;
      return balance;
  }
  
  
  // main function - start here
  int main(void)
  {
      int ch;
      int opt = 0;
      int amount = 0;
      int balance = 0;
      float newbal = 0.0;
  
      opt = getOption();
      printf(&quot;\nYou chose option %d\n&quot;, opt);
      if (opt == 1)
      {
          amount = withdrawCash();
          newbal = updateBalance(10000, amount);
          printf(&quot;\nHere is your %d, your balance is:\n&quot;, amount, newbal);
      }
      if (opt == 2)
      {
          balance = getBalance();
          printf(&quot;\nHere is your balance: %d\n&quot;, balance);
      }
  
      printf(&quot;\nThank you. Please take your card.\n&quot;);
      ch = getchar();
  
      return 0;
  }
  </code></pre>