title: Why is GCC saying multiple definitions of main? I have one main
body: <p>I can successfully run and compile my code using microsoft visual studio. When I try to compile it using gcc to submit my program through SSH, I get an error saying multiple definitions of main. I only have one main function, and I don't call my main anywhere. </p>
  
  <p>Here is the compiler's error message:</p>
  
  <pre><code>/tmp/ccsoZK9a.o: In function `main':
  ipc_ms1_prof.c:(.text+0x0): multiple definition of `main'
  /tmp/cciG56p6.o:ipc_ms1.c:(.text+0x0): first defined here
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Here is my code: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  //Prototype Functions
  void welcome(void);
  void prnTitle();
  void prnFooter(double gTotal);
  void clrKyb(void);
  void pause(void);
  int getInt(void);
  int getIntLimited(int lowerLimit, int upperLimit);
  double getDbl(void);
  double getDblLimited(double lowerLimit, double upperLimit);
  
  int main(void)
  {
  int iVal = 0;
  double dVal = 0.00;
  welcome();
  printf("listing header and footer with grand total:\n");
  prnTitle();
  
  prnFooter(1234.5678);
  printf("listing header and footer without grand total:\n");
  prnTitle();
  prnFooter(-1);
  
  pause();
  
  printf("Enter an integer: ");
  iVal = getInt();
  printf("You entered: %d\n", iVal);
  
  printf("Enter an integer between 10 an 20: ");
  iVal = getIntLimited(10, 20);
  printf("Your entered %d\n", iVal);
  
  printf("Enter a floating point number: ");
  dVal = getDbl();
  printf("You entered: %0.2lf\n", dVal);
  
  printf("Enter a floating point number between 10.00 and 20.00: ");
  dVal = getDblLimited(10.0, 20.0);
  printf("You entered: %0.2lf\n", dVal);
  
  printf("End of tester program for milestone one!\n");
  
  return 0;
  }
  
  void welcome(void)
  {
  printf("---=== Grocery Inventory System ===---\n\n");
  }
  void prnTitle()
  {
  printf("Row |SKU| Name               | Price  |Taxed| Qty | Min |   Total            |Atn\n");
  printf("----+---+--------------------+--------+-----+-----+-----+------------|---\n");
  }
  void prnFooter(double gTotal)
  {
  printf("--------------------------------------------------------+----------------\n");
  if (gTotal &gt; 0)
      printf("                                           Grand Total: |     %12.2lf\n", gTotal);
  }
  
  void clrKyb(void)
  {
  char input = ' ';
  //Keep getting user input as long as input is not equal to enter('\n')
  do
  {
      scanf("%c", &amp;input);
  } while (input != '\n');
  }
  void pause(void)
  {//Pause the program as until the user presses enter
  printf("Press &lt;ENTER&gt; to continue...");
  clrKyb();
  }
  
  int getInt(void)
  {
  char NL = 'x';//NL is x because that is one char whereas a number would be     int                                          
  int value;
  while (NL != '\n') {
      //loop is broken if not \n so it is routed to another loop to keep loop going until \n
      scanf("%d%c", &amp;value, &amp;NL);
      if (NL != '\n') {
          clrKyb();
          printf("Invalid integer, please try again: ");
      }
  }
  
  return value;
  
  }
  int getIntLimited(int lowerLimit, int upperLimit)
  {
  int value = 0;
  
  value = getInt();
  while (value &lt; lowerLimit || value &gt; upperLimit)
  {//while user input is not within the right numerical range
      //Display error message
      printf("Invalid value, %d &lt; value &lt; %d: ", lowerLimit, upperLimit);
      value = getInt();//call getInt to get user input again
  }
  
  return value;
  }
  
  double getDbl(void)//Similar to getInt.. double version
  {
  char NL = 'x';
  double value;
  while (NL != '\n') {
      scanf("%lf%c", &amp;value, &amp;NL);
      if (NL != '\n') {
          clrKyb();
          printf("Invalid integer, please try again: ");
      }
  }
  
  return value;
  }
  double getDblLimited(double lowerLimit, double upperLimit)
  {
  double value = 0;
  
  value = getDbl();
  while (value &lt; lowerLimit || value &gt; upperLimit)
  {
      printf("Invalid value, %lf &lt; value &lt; %lf: ", lowerLimit, upperLimit);
      value = getDbl();
  }
  
  return value;
  }//Similar to getIntLimited but the double version
  </code></pre>