Compiling Mex with GCC on Windows

조회 수: 5 (최근 30일)
Wajahat
Wajahat 2012년 7월 13일
Hi
Any idea how to compile Mex files with GCC on Windows, other than using gnumex?
Best Regards
Wajahat

답변 (2개)

Ken Atwell
Ken Atwell 2012년 7월 16일
gnumex may be your best bet; compilers that MEX supports does not include gcc on Windows. Just curious -- Is there a particular reason you need gcc? The Windows SDK 7.1 is free (as in beer, at least) and full-featured.
  댓글 수: 2
Wajahat
Wajahat 2012년 7월 19일
편집: Walter Roberson 2012년 7월 19일
I have a piece of code that uses some declarations which are slightly different in GCC then microsoft visual C++. The mex compilation works perfectly on Linux with GCC and gives errors on Windows with Visual C++ 2010 such as:
error C2143: syntax error : missing ';' before 'const'
error C2065: 'dim' : undeclared identifier
error C2109: subscript requires array or pointer type error C2065: 'dim' : undeclared identifier
error C2109: subscript requires array or pointer type
error C2065: 'dim' : undeclared identifier error C2109: subscript requires array or pointer type
error C2143: syntax error : missing ';' before 'type'
error C2143: syntax error : missing ';' before 'type' and so on...
Ken Atwell
Ken Atwell 2012년 7월 19일
Okay, thanks for the clarification.

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


Wajahat
Wajahat 2012년 7월 30일
Solved. Used Gnumex with MinGW, Cygwin was not working with Gnymex, I do not know why. Followed the instructions at Gnumex page, which is simple, just give the path to MinGW compiler root folder etc.
When it creats mexopts.bat, use: mex -f c:\gnumex\mexopts.bat c:\progra~1\MATLAB\R2012a\extern\examples\mex\yprime.c
to compile mex file.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by