필터 지우기
필터 지우기

Mex error with GNU Scientific Library

조회 수: 1 (최근 30일)
dave
dave 2013년 10월 2일
편집: Li Fei 2014년 3월 5일
Hi,
I've downloaded c++ code from the file exchange that implements the low discrepancy sequence generator by Niederreiter. Just like the instructions say in the Readme, I installed the GNU Scientific Library (GSL) and then tried to compile the code using the following command:
mex niederreiter.c -lgsl -lgslcblas -lm
However, this gives me the following errors:
niederreiter.c:28:27: error: gsl/gsl_qrng.h: No such file or directory
niederreiter.c: In function 'mexFunction':
niederreiter.c:80: error: 'gsl_qrng' undeclared (first use in this function)
niederreiter.c:80: error: (Each undeclared identifier is reported only once
niederreiter.c:80: error: for each function it appears in.)
niederreiter.c:80: error: 'q' undeclared (first use in this function)
niederreiter.c:196: error: 'gsl_qrng_niederreiter_2' undeclared (first use in this function)
mex: compile of ' "niederreiter.c"' failed.
I'm perplexed why these files/directories can't be found, since the installation of GSL worked without any problems - I even ran make check, but it didn't find any issues.
Any idea what's wrong here? Thanks..
btw: I'm using MatlabR2012a and MatlabR2012b on MacOSX 10.6.8. XCode 3.2.6 is installed.
  댓글 수: 2
Lokesh Ravindranathan
Lokesh Ravindranathan 2013년 10월 2일
I have not tried to install the package, but from the error message could you check if the header file (gsl_qrng.h)is present. It seems like the rest of the errors is because the symbols are defined in the header file and the main function does not have access to it.
dave
dave 2013년 10월 2일
편집: dave 2013년 10월 2일
Yes, the header file is there. So I guess it probably has something to do with the path..

댓글을 달려면 로그인하십시오.

채택된 답변

Harsheel
Harsheel 2013년 10월 2일
I think you need to provide the -I (capital i) flag along with MEX so that MEX can find the #include's present in niederreiter.c
mex niederreiter.c -I<path_to_gsl_qrng.h> -lgsl -lgslcblas -lm
Note that the angular brackets are not required and that there should not be any space character between I and the path that you provide. More info. can be found here:
  댓글 수: 4
dave
dave 2013년 10월 2일
@Jan Simon: Ah, that's my mistake - I thought it'd only search for "gsl_qrng.h". Thanks a lot for your help, now the compilation works fine.
Li Fei
Li Fei 2014년 3월 5일
편집: Li Fei 2014년 3월 5일
Hi experts in Matlab and GSL, @dave @Jan Simon @Harsheel,
I am also using the GSL in Matlab. But I can not figure out how to call the GSL function in Matlab. GSL is for linux, however I am using Matlab in Windows. Could you please give some advice to me about the GSL calling from Matlab in Windows.
Thank you very much in advance.
PS: I'm using MatlabR2013a on Windows XP SP3.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Write 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