MATLAB Answers

Matlab Compiler error (cpp files)

5 views (last 30 days)
Melissa
Melissa on 17 May 2011
[EDIT: 20110716 09:13 CDT - reformat - WDR]
Good Morning All,
Very new to the Matlab programming or any programming for that matter. I recently tried to use the compiler to translate my code to C++. I have been given an error code of 9 after making an mbuild. If someone could please explain to me what this means or even tell me how to fix it, I would really appreciate it. I have desire to learn the debugging so an explanation would be wonderful for my future errors I know I will make.
Here is the deploy tool command window:
ant:
<mkdir dir="C:\Users\melissa\Documents\MATLAB\interp1\distrib" />
<mkdir dir="C:\Users\melissa\Documents\MATLAB\interp1\src" />
mcc -W cpplib:interp1 -T link:lib -d C:\Users\melissa\Documents\MATLAB\interp1\src -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -v C:\Users\melissa\Documents\MATLAB\interp1.m
Compiler version: 4.13 (R2010a)
Processing include files...
2 item(s) added.
Processing directories installed with MCR...
The file C:\Users\melissa\Documents\MATLAB\interp1\src\mccExcludedFiles.log contains a list of functions excluded from the CTF archive.
2 item(s) added.
Generating MATLAB path for the compiled application...
Created 39 path items.
Begin validation of MEX files: Mon May 16 23:25:32 2011
End validation of MEX files: Mon May 16 23:25:32 2011
Parsing file "C:\Users\melissa\Documents\MATLAB\interp1.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2010a\toolbox\compiler\deploy\deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2010a\toolbox\compiler\deploy\printdlg.m"
(Referenced from: "Compiler Command Line").
Deleting 0 temporary MEX authorization files.
Generating file "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.h".
Generating file "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp".
Generating file "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.exports".
Generating file "C:\Users\melissa\Documents\MATLAB\interp1\src\readme.txt".
Generating file "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1_mcc_component_data.c".
Executing command: ""C:\Program Files\MATLAB\R2010a\bin\mbuild" -O -v -output "interp1" -I"C:\Users\melissa\Documents\MATLAB\interp1\src" "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp" "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.exports" "C:\Users\melissa\Documents\MATLAB\interp1\src\interp1_mcc_component_data.c" -link shared -outdir "C:\Users\melissa\Documents\MATLAB\interp1\src""
This is mbuild Copyright 1984-2006 The MathWorks, Inc.
-> Default options filename found in C:\Users\melissa\AppData\Roaming\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Users\melissa\AppData\Roaming\MathWorks\MATLAB\R2010a\compopts.bat
-> COMPILER = lcc
-> Compiler flags:
COMPFLAGS = -c -Zp8 -I"C:\PROGRA~1\MATLAB\R2010a\sys\lcc\include" -noregistrylookup
OPTIMFLAGS = -DNDEBUG
DEBUGFLAGS = -g4
arguments = -IC:\USERS\MELISSA\DOCUME~1\MATLAB\INTERP1\SRC
Name switch = -Fo
-> Pre-linking commands =
-> LINKER = lcclnk
-> Link directives:
LINKFLAGS = -dll "C:\USERS\MELISSA\APPDATA\LOCAL\TEMP\MBUILD~1\templib.def" -tmpdir "C:\USERS\MELISSA\DOCUME~1\MATLAB\INTERP1\SRC\." -L"C:\PROGRA~1\MATLAB\R2010a\sys\lcc\lib" -libpath "C:\PROGRA~1\MATLAB\R2010a\extern\lib\win32\lcc" C:\USERS\MELISSA\APPDATA\LOCAL\TEMP\MBUILD~1\templib_stub.obj
LINKFLAGSPOST = mclmcrrt.lib
Name directive = -o "C:\USERS\MELISSA\DOCUME~1\MATLAB\INTERP1\SRC\interp1.dll"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler =
-> Resource Linker =
----------------------------------------------------------------
--> lcc -IC:\USERS\MELISSA\DOCUME~1\MATLAB\INTERP1\SRC -c -Zp8 -I"C:\PROGRA~1\MATLAB\R2010a\sys\lcc\include" -noregistrylookup -FoC:\USERS\MELISSA\APPDATA\LOCAL\TEMP\MBUILD~1\interp1.obj -IC:\PROGRA~1\MATLAB\R2010a\extern\include -IC:\PROGRA~1\MATLAB\R2010a\simulink\include -DNDEBUG C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 syntax error; found `void' expecting `;'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 missing parameter type
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 syntax error; found `&' expecting `)'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 skipping `&' `v' `,'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 syntax error; found `const' expecting `{'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 redeclaration of `mwArray' previously declared at C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp 166
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 syntax error; found `&' expecting `;'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 undeclared identifier `varargin'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 syntax error; found `)' expecting `;'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 illegal statement termination
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 166 skipping `)'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 168 undeclared identifier `v'
Warning C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 Statement has no effect
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 syntax error; found `void' expecting `;'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 illegal statement termination
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 skipping `void'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 illegal expression
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 syntax error; found `nargout' expecting `)'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 insufficient number of arguments to `interp1'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 syntax error; found `nargout' expecting `;'
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 undeclared identifier `v'
Warning C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 Statement has no effect
Error C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp: 172 too many errors
C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Compile of 'C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp' failed.
Error: An error occurred while shelling out to mbuild (error code = 9).
Unable to build executable.
I tried to locate the C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp file but it was not there so perhaps I should redo the mbuild?

Answers (1)

Kaustubha Govind
Kaustubha Govind on 18 May 2011
Since you are attempting to build a C++ shared library, you need to select a C++ compiler using "mbuild -setup". The list of supported compilers for R2010a is here.
LCC is a C-only compiler, so it errors out when attempting to compile C++ code.
Also, the file C:\Users\melissa\Documents\MATLAB\interp1\src\interp1.cpp is a (hidden) intermediate product of MATLAB Compiler - code is generated and compiled immediately into a binary. To my knowledge, the generated code is deleted during termination. This is probably why you do not see the file.
  4 Comments
Kaustubha Govind
Kaustubha Govind on 13 Sep 2012
Did you run "mex -setup" as the error suggests? Note that you need to have installed a supported compiler.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!