title: __cdecl LNK 2019 VS2010 C
body: <p>I am trying to implement a few simple functions in C (VS2010). Should be very easy. BUT, I am receiving </p>
  
  <blockquote>
    <p>error LNK2019: unresolved external symbol "1>test01.obj : error LNK2019: unresolved external symbol "int __cdecl Ex2(int,int)" (?Ex2@@YAHHH@Z) referenced in function _main
    1>test01.obj : error LNK2019: unresolved external symbol "void __cdecl Ex1(int *,int)" (?Ex1@@YAXPAHH@Z) referenced in function _main</p>
  </blockquote>
  
  <p>for both functions although it worked when I've created the first function (Ex1).. Declaration and prototypes looking good to me..
  There is only one C file with functions in it.
  I'll be glad for any advice.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  //Function prototypes/////////////////////////////////
  
  void Ex1(int*, int);
  int Ex2(int, int);
  
  ///////////////////////////////////////////////////// 
  
  int main()
  {
    int select = 0, i, all_Ex_in_loop = 0, arrsize = 0;
    int a = -3, b = 13; // EX 2 variables
  
    int* arrPtr;              //EX1 definitions
    int arr[] =
    { 7, 5, -8, 3, 4, 21, -10, -3, 2, 4 };
    arrsize = sizeof(arr) / sizeof(int);
    arrPtr = arr;
  
    printf(
        "Run menu once or cyclically?\n(Once - enter 0, cyclically - enter other number) ");
    if (scanf_s("%d", &amp;all_Ex_in_loop) == 1)
      do
      {
        for (i = 1; i &lt;= 5; i++)
          printf("Ex%d---&gt;%d\n", i, i);
        printf("EXIT--&gt;0\n");
        do
        {
          select = 0;
          printf("please select 0-5 : ");
          scanf_s("%d", &amp;select);
        } while ((select &lt; 0) || (select &gt; 5));
        switch (select)
        {
        case 1:
          Ex1(arrPtr, arrsize);
          break;
        case 2:
          Ex2(a, b);
          break;
  //case 3: Ex3(); break;
  //case 4: Ex4(); break;
  //case 5: Ex5(); break;
        }
      } while (all_Ex_in_loop &amp;&amp; select);
    return 0;
  }
  
  // ---------------------------------------------- EX1 -------------------------------------------------------------
  void Ex1(int* ptr, int size)
  {
    int i;
  
    printf("Original array: ");
    for (i = 0; i &lt; size; i++)
    {
      printf("%d, ", ptr[i]);
    }
    for (i = 1; i &lt; size; i++)
    {
      ptr[i] += ptr[i - 1];
    }
  
    printf("\n Updated array: ");
    for (i = 0; i &lt; size; i++)
    {
      printf("%d, ", ptr[i]);
    }
    printf("\n");
  
  }
  
  //---------------------------------------------------------------- EX2 ------------------------------------------------------------
  
  int Ex2(int a, int b)
  {
    int firstVal = 0, secVal = 0, num = 0;
  
    printf("Please enter numbers. -1 to finish: ");
    while (num != -1)
    {
      scanf_s("%d", &amp;num);
      if (num &gt; (a + b) / 2 &amp;&amp; num &lt; b)
      {
        firstVal += num;
      }
      if (num &gt; a &amp;&amp; num &lt; (a + b) / 2)
      {
        secVal += num;
      }
    }
  
    printf("\n The value is: %d", firstVal + secVal);
  
    return firstVal + secVal;
  }
  </code></pre>