Compiling Matlab mex files with GCC for Windows

조회 수: 9 (최근 30일)
Wajahat
Wajahat 2012년 5월 17일
댓글: Wajahat 2015년 7월 7일
Hi I have been trying to configure Windows Matlab with GCC to compile mex files, through gnumex, http://gnumex.sourceforge.net/ but I get the following error,
C:\PROGRA~2\MATLAB\R2012A\BIN\MEX.PL: Error: Could not find specified options file 'mexopts.bat'.
mexopts.bet is created and is in the path.
Can someone help me on this?
Best Regards
Wajahat
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 5월 18일
Please check, do you have a .bat file or a .bet file?
Wajahat
Wajahat 2012년 5월 22일
I have a .bat file.
I can configure with MSVC++ compiler and mex runs perfectly. But a certain code is optimized for GCC and even after installation Matlab does not does GCC (although it does in Linux but not in Windows).
So in order to use GCC, I have to use gnumex. This is what I found on the web as the only way out. But that is also not working?

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

답변 (2개)

Bruce Elliott
Bruce Elliott 2013년 11월 6일
Wajahat,
Were you ever able to resolve this?
I would have asked if you were using the -f flag with your call to mex, which allows you to point to your mexopts.bat file.
Also, note that gnumex creates the mexopts.bat file in the folder you specify, which should be in your user space somewhere, but it also copies the file to %Matlab root%\bin\win64\ (or equivalent), to which you might not have write privileges.
Bruce
  댓글 수: 1
Wajahat
Wajahat 2015년 7월 7일
I resolved it by selecting GCC compiler in gnumex. Earlier I was selecting MinGW. Thanks a lot for your answers Best Regards Wajahat

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


Ora Zyto
Ora Zyto 2012년 5월 22일
Please note that you should only use a supported compiler when compiling MEX files, and directly modifying the mexopts.bat file is strongly discouraged and can lead to many issues. Refer to the supported compilers page for your architecture at: http://www.mathworks.com/support/compilers/R2012a/win32.html
MEX compilation relies on finding the appropriate mexopts.bat file in your preference directory. This can be located by typing the command:
>> prefdir
in your MATLAB command prompt. Running the command mex -setup will take care of setting this up correctly.
  댓글 수: 1
Wajahat
Wajahat 2012년 5월 22일
yeah sure, I am not changing mexopts.bat myself but using gnumex to change it.

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

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by