<p>Hmm, the exception is being called from the following code, in <code>hmm_util_impl.hpp:128</code> (frame 11):</p>

<pre><code>std::ofstream ofs(modelFile);
ArchiveType ar(ofs);
</code></pre>

<p>In this particular case, <code>ArchiveType = boost::archive::xml_oarchive</code>.</p>

<p>My off-the-cuff guess is that <code>ofs</code> is not opened correctly, which then causes the <code>xml_oarchive</code> to throw the stream error exception.  One thing I can do here is add checks to make sure the stream opened, which I did in <a href="https://github.com/mlpack/mlpack/commit/2720ddc294241487a6ed01aa42dfff2be878702d" class="commit-link"><tt>2720ddc</tt></a>.  So if you update and recompile, I think you will get a more useful error message, but my best guess here is that the file 'output.xml' cannot be opened... maybe you don't have permissions to write in the directory, or maybe for some reason 'output.xml' already exists as a directory or is owned by some other user?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/489#issuecomment-161981048">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFNe4QHKIZRaxGy6QyuPS5TOYQJwIks5pMZukgaJpZM4GuujW.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/489#issuecomment-161981048"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>