Using GSL on Matlab Mex

2 ビュー (過去 30 日間)
Saravanan Nagesh
Saravanan Nagesh 2021 年 7 月 29 日
コメント済み: Saravanan Nagesh 2021 年 8 月 6 日
Hi I am trying to run a .cpp code on Matlab which has dependencies on the GSL library. I have as of now done the following steps:
  1. Installed the latest MinGW complier
  2. Currently using the latest Matlab 2021
  3. Downloaded the GSL library from https://www.gnu.org/software/gsl/
  4. Unzipped the contents of the software package and placed the files in the folder named gsl in the location where i have my .cpp code.
  5. Added the gsl folder and all subfolders to the path.
However when I use the command "mex Mymexcode.cpp;" , the code stops with the error
"C:\user\myfolder\gsl/gsl_math.h:23:25: fatal error: gsl/gsl_sys.h: No such file or directory
#include <gsl/gsl_sys.h>
compilation terminated.
Could anyone please let me know where i am going wrong??

回答 (1 件)

Amogh Bhole
Amogh Bhole 2021 年 8 月 4 日
From my understanding your gsl folder is missing the gsl_sys.h header file. Please find the correct path of gsl_sys.h and update it in the include statement of the header file gsl_math.h or copy this file and paste it on the gsl folder this way you won’t have to update the gsl_math.h header file.
  1 件のコメント
Saravanan Nagesh
Saravanan Nagesh 2021 年 8 月 6 日
Dear Amogh,
Thank you for the answer, but the gsl_sys.h file is present in the folder with the gsl_math.h, I have also used the -I command to include both the include folder path and also the library path.
Still the error is persistent.
I also suspect that the compilation of the gsl library also may be an issue which may have caused an error in linking of the files.
Is it possible you have a link to a source where I may get a compiled gsl library which I can use.
Unfortunately the official gsl website does not provide this.
Many thanks in advance.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by