Problem compiling mex files

4 views (last 30 days)
Michael
Michael on 20 Aug 2014
Commented: Geoff Hayes on 21 Aug 2014
The error I get is the following
compiling : ._bspline_error_2d_double.c -> Default options filename found in C:\Users\Orger\AppData\Roaming\MathWorks\MATLAB\R2012a ---------------------------------------------------------------- -> Options file = C:\Users\Orger\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat MATLAB = C:\Program Files\MATLAB\R2012a -> COMPILER = cl -> Compiler flags: COMPFLAGS = /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD OPTIMFLAGS = /O2 /Oy- /DNDEBUG DEBUGFLAGS = /Z7 arguments = Name switch = /Fo -> Pre-linking commands = -> LINKER = link -> Link directives: LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\Orger\AppData\Local\Temp\mex_1feKKo\templib.x" /MAP:"_bspline_error_2d_double.mexw64.map" LINKDEBUGFLAGS = /debug /PDB:"_bspline_error_2d_double.mexw64.pdb" LINKFLAGSPOST = Name directive = /out:"_bspline_error_2d_double.mexw64" File link directive = Lib. link directive = Rsp file indicator = @ -> Resource Compiler = rc /fo "mexversion.res" -> Resource Linker = ----------------------------------------------------------------
--> cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\Users\Orger\AppData\Local\Temp\mex_1feKKo\.obj -I"C:\Program Files\MATLAB\R2012a\extern\include" /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 ._bspline_error_2d_double.c
._bspline_error_2d_double.c ._bspline_error_2d_double.c : warning C4821: Unable to determine Unicode encoding type, please save the file with signature (BOM) ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x5' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x16' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x7' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x2' ._bspline_error_2d_double.c(1) : error C2061: syntax error : identifier 'OS' ._bspline_error_2d_double.c(1) : error C2059: syntax error : ';' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x2' ._bspline_error_2d_double.c(1) : error C2143: syntax error : missing '{' before 'constant' ._bspline_error_2d_double.c(1) : error C2059: syntax error : '<Unknown>' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0xe' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x2' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0xe' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1e' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0xe' ._bspline_error_2d_double.c(1) : error C2061: syntax error : identifier 'É~9' ._bspline_error_2d_double.c(1) : error C2059: syntax error : ';' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x15' ._bspline_error_2d_double.c(1) : error C2061: syntax error : identifier 'com' ._bspline_error_2d_double.c(1) : error C2059: syntax error : ';' ._bspline_error_2d_double.c(1) : error C2059: syntax error : '.' ._bspline_error_2d_double.c(1) : error C2021: expected exponent value, not 'b' ._bspline_error_2d_double.c(1) : error C2059: syntax error : 'bad suffix on number' ._bspline_error_2d_double.c(1) : error C2059: syntax error : 'constant' ._bspline_error_2d_double.c(1) : error C2143: syntax error : missing '{' before '-' ._bspline_error_2d_double.c(1) : error C2059: syntax error : '-' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1e' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1e' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1c' ._bspline_error_2d_double.c(1) : error C2018: unknown character '0x1e'
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of '._bspline_error_2d_double.c' failed.
I have tried using Matlab R2012A with Microsoft SDK as the compiler, and I also tried on another computer R2010A using Visual C++ 2010 Express and got the same error. I also tried adding a BOM to the file bspline_error_2d_double.c which didn't seem to fix the problem (maybe it is another file that needs a BOM?).
Thank you to anyone who can help. This is quite frustrating, and I have not been able to find anyone with a similar problem by googling.
  3 Comments
Michael
Michael on 21 Aug 2014
Hi Geoff, Thanks for your response. The Matlab 2010 version only offers the Visual C++ or Intel compilers. The 2012 offers the Visual c++, Intel and Microsoft SDK as options. The lcc option seems to come with later versions of Matlab. Was it an available option for you on the mex -setup, or did you manually add it to the setup file?
Geoff Hayes
Geoff Hayes on 21 Aug 2014
Saw from your answer below that you figured out the problem - great! The lcc option was available when I ran mex-setup (I didn't have to manually add it).

Sign in to comment.

Accepted Answer

Michael
Michael on 21 Aug 2014
PROBLEM SOLVED: It turns out the problem was that I had first downloaded the packages on a Mac and then copied them onto the Windows machine. Somewhere along the line, hidden files (with the prefix ._) with the .c extension were added to the folders by the Mac, and the windows compiler was trying unsuccessfully to read them. When I redownloaded the packages on the windows machine, everything was good.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!