title: Octave c++ and VS2010
body: <p>I'm trying to Use Octave with Visual C++.</p>
  
  <p>I have downloaded <a href="http://sourceforge.net/projects/octave/files/Octave%20Windows%20binaries/Octave%203.6.1%20for%20Windows%20Microsoft%20Visual%20Studio/" rel="nofollow"><code>octave-3.6.1-vs2010-setup-1.exe</code></a>. Created a new project, added octave <code>include</code> folder to include path, <code>octinterp.lib</code> and <code>octave.lib</code> to lib path, and I added Octave <code>bin</code> folder as running directory.</p>
  
  <p>The program compiles and runs fine except <code>feval</code> function that causes the exception:</p>
  
  <blockquote>
    <p>Microsoft C++ exception: octave_execution_exception at memory location 0x0012faef</p>
  </blockquote>
  
  <p>and on Octave side:</p>
  
  <blockquote>
    <p>Invalid resizing operation or ambiguous assignment to an out-of-bounds array element.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <hr>
  
  <p>Code for a <a href="https://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html#Standalone-Programs" rel="nofollow">standalone program</a>:</p>
  
  <pre><code>#include &lt;octave/octave.h&gt;
  #include &lt;octave/oct.h&gt;
  #include &lt;octave/parse.h&gt;
  
  int main(int argc, char **argv)
  {
      if (octave_main (argc, argv, true))
      {
          ColumnVector NumRands(2);
          NumRands(0) = 10;
          NumRands(1) = 1;
          octave_value_list f_arg, f_ret;
          f_arg(0) = octave_value(NumRands);
          f_ret = feval("rand",f_arg,1);
          Matrix unis(f_ret(0).matrix_value());
      }
      else
      {
          error ("Octave interpreter initialization failed");
      }
      return 0;
  }
  </code></pre>
  
  <p>Thanks in advance.</p>