簡體   English   中英

Octave:編譯 C++ 文件時找不到 mkoctfile

[英]Octave: mkoctfile not found when compiling a C++ file

我正在嘗試在 C++ 中使用 Octave 函數。 我在 Mac OS X 10.9.3 上安裝 Octave-3.8.0 並遵循 Octave 網站上的獨立程序示例,

#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;
}

然后我輸入

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

但它顯示 mkoctfile: command not found。 問題是什么?

我也嘗試用 g++ 編譯 C++ 文件

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

但它顯示 2 個錯誤如下。 1) 'config.h' 文件未在 include 中找到; 改用“引號”。 2) 致命錯誤:找不到“hdft.h”文件。

請幫我!

根據 shell 響應判斷,可能是 Octave 未在您的系統中正確注冊。

嘗試從八度解釋器內部調用命令。

不確定在 MacOS 上,但在 Linux 上, mkoctfile未捆綁在默認的 Octave 發行版中。 相反,它需要一個補充包liboctave-dev ,除了 Octave 本身之外還必須安裝它。

這在 Octave 網絡教程中沒有記錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM