title: error LNK2001: unresolved external symbol "int * array"
body: <p>when i try to compile it i have this error , and i really have no idea what to do .
  Maybe you can help me about this .</p>
  
  <p>Main.cpp:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;list&gt;
  using namespace std;
  
  list&lt;int&gt; liste;
  int size=0;
  
  void list_initialization(){
      cout &lt;&lt; "Quicksort" &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt;"List Initialization" &lt;&lt; endl;
      while ((size&lt;1)||size&gt;100){
          cout &lt;&lt; "Please enter the size (between 1 and 100)" &lt;&lt; endl;
          cin &gt;&gt; size;
      }
      srand ( time(NULL) );
      for (int i=0; i&lt;size; i++){
          liste.push_back(rand() %100 +1);
      }
  }
  
  void list_display(){
      cout &lt;&lt; endl;
      for (list&lt;int&gt;::const_iterator ite=liste.begin(), end=liste.end(); ite!=end; ++ite)
              cout &lt;&lt; *ite &lt;&lt; " ";
      cout &lt;&lt; endl;
  }
  
  int choose_pivot( int const&amp; left, int const&amp; right){
      int pivot;
      pivot = rand()%(right-left) + left ;
      return pivot;
  }
  
  int partition(int left, int right, int pivotIndex){
  
  
      //We Save pivotValue
      list&lt;int&gt;::iterator itPivotIndex = liste.begin();
      advance (itPivotIndex, pivotIndex);
      int pivotValue = *itPivotIndex;
  
      //Those 2 iterators will be used to swap 2 elements
      list&lt;int&gt;::iterator itSwap1 = liste.begin();
      list&lt;int&gt;::iterator itSwap2 = liste.begin();
  
      //2 iterators to point left and right elements
      list&lt;int&gt;::iterator itLeft = liste.begin();
      advance (itLeft, left);
      list&lt;int&gt;::iterator itRight = liste.begin();
      advance (itRight, right);
  
      //1 iterator to point the StoreIndex
      list&lt;int&gt;::iterator itStoreIndex=itLeft;
  
  
      //Move Pivot to End
      advance(itSwap1, pivotIndex);
      advance(itSwap2, right);
      swap(*itSwap1, *itSwap2);
  
  
      //Move all elements less than pivotValue before the pivot
  
      for(list&lt;int&gt;::iterator it=itLeft; it!=itRight; it++)
          if (*it &lt; pivotValue){
  
              //Swap array[k] and array[storeIndex]
              itSwap1=it;
              itSwap2=itStoreIndex;
              swap(*itSwap1, *itSwap2);
  
              itStoreIndex++;
          }
  
      //Move pivot to its final place
      swap(*itStoreIndex, *itRight);
  
      return (distance(liste.begin(), itStoreIndex));
  }
  
  
  void quicksort (int left, int right){
  
      int pivotNewIndex=0;
      list&lt;int&gt;::iterator ite=liste.begin();
  
      if (left &lt; right){
  
          int pivotIndex = choose_pivot(left,right);
          advance (ite,pivotIndex);
          cout &lt;&lt; "The pivot is " &lt;&lt; *ite &lt;&lt;endl;
  
          pivotNewIndex = partition(left, right, pivotIndex);
  
          list_display();
          cout &lt;&lt; endl;
  
          // Recursively sort elements smaller than the pivot
      quicksort(left, pivotNewIndex - 1);
  
          // Recursively sort elements at least as big as the pivot
      quicksort(pivotNewIndex + 1, right);
      }
  
  }
  
  int main()
  {
      list_initialization();
      list_display();
      cout &lt;&lt; endl;
  
      int left=0;
      int right=size-1;
  
      quicksort(left, right);
      cout &lt;&lt; "Sorted List :";
      list_display();
  
      cout &lt;&lt; endl;
      return 0;
  
  }
  </code></pre>
  
  <p>quicksort.cpp:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;list&gt;
  using namespace std;
  
   extern int array [];
  
  int selectPivot( int const&amp; left, int const&amp; right);
  int Partition(int left, int right, int pivotIndex);
  void sorting (int left, int right);
  
  int selectPivot( int const&amp; left, int const&amp; right){
      int pivot;
      pivot = rand()%(right-left) + left ;
      return pivot;
  }
  
  int Partition(int left, int right, int pivotIndex){
  
      int temp=0;
      int storeIndex=left;
      int pivotValue = array[pivotIndex];
  
  
      temp=pivotValue;
      pivotValue=array[right];
      array[right]=temp;
  
  
      for (int k=left; k&lt;right; k++)
          if (array[k] &lt; pivotValue){
  
              temp=array[k];
              array[k]=array[storeIndex];
              array[storeIndex]=temp;
  
              storeIndex++;
          }
  
      temp = array[storeIndex];
      array[storeIndex]=array[right];
      array[right]=temp;
  
      return storeIndex;
  }
  
  
  void sorting (int left, int right){
  
      int pivotNewIndex=0;
  
      if (left &lt; right){
  
          int pivotIndex = selectPivot(left,right);
  
          pivotNewIndex = Partition(left, right, pivotIndex);
  
  
          sorting(left, pivotNewIndex - 1);
  
  
          sorting(pivotNewIndex + 1, right);
      }
  
  }
  </code></pre>
  
  <p>-------------- 1>------ Build started: Project: practical2, Configuration: Debug Win32 ------ 1>Compiling... 1>quicksort.cpp 1>Linking... 1>quicksort.obj : error LNK2001: unresolved external symbol "int * array" (?array@@3PAHA) 1>C:\Users\Amed\Documents\Visual Studio 2008\Projects\practical2\Debug\practical2.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\Users\Amed\Documents\Visual Studio 2008\Projects\practical2\practical2\Debug\BuildLog.htm" 1>practical2 - 2 error(s), 0 warning(s)
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========</p>