Octave: mkoctfile not found when compiling a C ++ file

I am trying to use Octave functions in C ++. I install Octave-3.8.0 on Mac OS X 10.9.3 and follow the example of a standalone program on the Octave website ,

#include <iostream>
#include <octave/oct.h>

int
main (void)
{
std::cout << "Hello Octave world!\n";

int n = 2;
Matrix a_matrix = Matrix (n, n);

for (octave_idx_type i = 0; i < n; i++)
  for (octave_idx_type j = 0; j < n; j++)
    a_matrix(i,j) = (i + 1) * 10 + (j + 1);

 std::cout << a_matrix;

return 0;
}

Then i type

      $ mkoctfile --link-stand-alone main.cpp -o standalone

But it shows mkoctfile: command not found. What is the problem?

I also tried compiling a C ++ file with g ++

     $ g++ -I /usr/local/octave/3.8.0/include/octave-3.8.0 main.cpp

but it shows 2 errors as follows. 1) File config.h not found with include; use quotes instead. 2) fatal error: hdft.h file not found.

Please help me!

+4
source share
1 answer

Perhaps the octave is not registered in your system correctly, judging by the reaction of the shell.

.

0

Source: https://habr.com/ru/post/1542796/


All Articles