title: C++ exception handler used, but unwind semantics are not enabled: What does it mean, and how do I fix it?
body: <p>I am making a simple program that sorts a deck of cards by using a bubble sort and then displays it. I am getting a weird runtime error. Can someone explain the error to me and give suggestions on how to fix it?</p>
  <p>Error:</p>
  <blockquote>
  <p>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xlocale(341): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc</p>
  <p>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\exception(359): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc</p>
  <p>C:\SortedCards.cpp : fatal error C1083: Cannot open compiler generated file: 'C:\SortedCards.obj': Permission denied
  </p>
  </blockquote>
  <p>My Code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  class SortedCards
  {
  private:
      vector&lt;double&gt; v; 
      int nElems; 
  
      void swap(int one, int two) {
          double temp = v[one];
          v[one] = v[two];
          v[two] = temp; 
      }
  
  public:
      SortedCards(int max) : nElems(0)
      {
          v.resize(max);
      }
  
      void insert(double value)
      {
          v[nElems] = value; 
          nElems++; 
      }
  
      void display() {
          for (int i = 0; i &lt; nElems; i++) {
              if (v[i] == 11) {
                  cout &lt;&lt; &quot;A &quot;; 
              }
              else if (v[i] == 12) {
                  cout &lt;&lt; &quot;J &quot;;
              }
              else if (v[i] == 13) {
                  cout &lt;&lt; &quot;Q&quot;;
              }
              else if (v[i] == 14) {
                  cout &lt;&lt; &quot;K&quot;; 
              }
              else {
                  cout &lt;&lt; v[i] &lt;&lt; &quot; &quot;;
              }
          }
          cout &lt;&lt; endl; 
      }
  
      void bubbleSort()
      {
          int out, in; 
          for (out = nElems - 1; out &gt; 1; out--) {
              for (in = 0; in &lt; out; in++) {
                  if (v[in] &gt; v[in + 1]) {
                      swap(in, in + 1); 
                  }
              }
          }
      }
  };
  
  int main() {
      int maxSize = 100;
      SortedCards arr(maxSize);
  
      arr.insert(1);
      arr.insert(2);
      arr.insert(3);
      arr.insert(4);
      arr.insert(5);
      arr.insert(6);
      arr.insert(7);
      arr.insert(8);
      arr.insert(9); 
      arr.insert(10);
      arr.insert(11);
      arr.insert(12);
      arr.insert(13);
      arr.insert(14);
      arr.insert(1);
      arr.insert(2);
      arr.insert(3);
      arr.insert(4);
      arr.insert(5);
      arr.insert(6);
      arr.insert(7);
      arr.insert(8);
      arr.insert(9);
      arr.insert(10);
      arr.insert(11);
      arr.insert(12);
      arr.insert(13);
      arr.insert(14); 
  
      arr.display();
      arr.bubbleSort();
      arr.display();
      return 0; 
          
  }
  </code></pre>