title: Trying to compile example code from Octave's Standalone Programs example, getting segfault on first line
body: <p>I am trying to learn how to embed Octave in my C++ code. When running the second example from <a href="http://octave.org/doc/v4.4.0/Standalone-Programs.html" rel="nofollow noreferrer">here</a>, the code compiles fine, but when running the code, a segmentation fault appears in the first line, when trying to initialize the interpreter. I'm not extremely adept at C++ but even when looking it up I can't find any answers.</p>
  
  <p>The original code had octave::feval instead of feval, that threw a different, namespace error, so I just got rid of that and added the parse.h in the includes. I doubt this is at all related to the issue but that is a modification I did do.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;octave/oct.h&gt;
  #include &lt;octave/octave.h&gt;
  #include &lt;octave/parse.h&gt;
  #include &lt;octave/interpreter.h&gt;
  
  int
  main (void)
  {
    // Create interpreter.
  
    octave::interpreter interpreter;
  
    try
      {
        int status = interpreter.execute ();
  
        if (status != 0)
          {
            std::cerr &lt;&lt; "creating embedded Octave interpreter failed!"
                      &lt;&lt; std::endl;
            return status;
          }
  
        octave_idx_type n = 2;
        octave_value_list in;
  
        for (octave_idx_type i = 0; i &lt; n; i++)
          in(i) = octave_value (5 * (i + 2));
  
        octave_value_list out = feval ("gcd", in, 1);
  
        if (out.length () &gt; 0)
          std::cout &lt;&lt; "GCD of ["
                    &lt;&lt; in(0).int_value ()
                    &lt;&lt; ", "
                    &lt;&lt; in(1).int_value ()
                    &lt;&lt; "] is " &lt;&lt; out(0).int_value ()
                    &lt;&lt; std::endl;
        else
          std::cout &lt;&lt; "invalid\n";
      }
    catch (const octave::exit_exception&amp; ex)
      {
        std::cerr &lt;&lt; "Octave interpreter exited with status = "
                  &lt;&lt; ex.exit_status () &lt;&lt; std::endl;
      }
    catch (const octave::execution_exception&amp;)
      {
        std::cerr &lt;&lt; "error encountered in Octave evaluator!" &lt;&lt; std::endl;
      }
  
    return 0;
  }
  </code></pre>
  
  <p>The actual output is supposed to be:</p>
  
  <pre><code>GCD of [10, 15] is 5
  </code></pre>
  
  <p>I am using Linux Ubuntu 18.04 with Octave 4.2.2</p>