title: Understanding error "terminate called after throwing an instance of 'std::length_error' what(): basic_string::_S_create Aborted (core dumped)"
body: <p>So here is my error:</p>
  
  <pre><code>terminate called after throwing an instance of 'std::length_error'
    what():  basic_string::_S_create
  Aborted (core dumped)
  </code></pre>
  
  <p>and here is my code:  </p>
  
  <pre><code>//Code removed
  
  string generateSong(string list[], int num)
  {
     //Code removed
  
     //Code removed
  
     for (i = 0; i &lt; num; i++)
     {
        output += list[i];
        output += bone1;
        output += list[i + 1];
        output += bone2;
     }
  
     return output;
  }
  
  int main()
  {
     string list[9] =
     {
  
     //Code removed
  
     };
  
     //Code removed
  
     return 0;
  }
  </code></pre>
  
  <p>I would just like to know what that error means so I know how to fix it.  I've seen many posts with similar errors but nothing exactly the same.  I am literally just starting out in C++, and none of those answers make sense with what I have learned so far.  As you can see this is a simple program to output a song.  It's meant to help me practice strings for the class I'm taking, but it makes absolutely no sense to me and the book isn't much help either.  Could someone please explain this to me?</p>
  
  <p>P.S. In case this is helpful, it will compile using g++, but when it runs it gives that error (so basically it's not a compile error, it's a run error).</p>