f



Compiling Matlab code to C++ code

Hi,
I'm trying to compile matlab code into C++. I ran mbuild -setup to use
MS VS.(on a side note, can Matlab use g++ instead? it only gave
options for MS VS and LCC) Then I  tried 'mcc -m add -d bin -v'

The program is simple:
function add(As, Bs)

A = str2num(As);
B = str2num(Bs);

C = A + B;

But I run into this non descriptive error message:

Generating MATLAB path for the compiled application...
Created 34 path items.
Depfun main loop converged in 2 iterations, total number of files =
11
Begin validation of MEX files: Thu Feb 22 09:04:57 2007
End validation of MEX files: Thu Feb 22 09:04:57 2007

Parsing file "C:\work\SimpleMatlabToCpp\add.m"
	(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\matlabrc.m"
	(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\compiler\dirname.m"
	(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m"
	(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\strfun
\str2num.m"
	(Referenced from: "C:\work\matlab_to_ossim_filter\SimpleMatlabToCpp
\add.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\hgrc.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\matlabrc.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\strfun
\str2double.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\matlabrc.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\general
\usejava.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\matlabrc.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\iofun
\fileparts.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler
\dirname.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\general
\addpath.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\graphics
\gcbf.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\general
\ispc.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\datatypes
\num2cell.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\strfun
\num2str.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\graphics
\orient.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\general
\path.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\printdlg.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\general
\rmpath.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Parsing file "C:\Program Files\MATLAB_R14\toolbox\matlab\iofun
\tempname.m"
	(Referenced from: "C:\Program Files\MATLAB_R14\toolbox\compiler\deploy
\deployprint.m").
Generating file "bin\add_main.c".
Generating file "bin\add_mcc_component_data.c".
Executing command: mbuild -O -v -output "add" -I"bin" "bin\add_main.c"
"bin\add_mcc_component_data.c" -link exe -outdir "bin"
 This is mbuild Copyright 1984-2004 The MathWorks, Inc.

-> Default options filename found in C:\Documents and Settings
\Tommy_2\Application Data\MathWorks\MATLAB\R14SP3
----------------------------------------------------------------
->    Options file           = C:\Documents and Settings
\Tommy_2\Application Data\MathWorks\MATLAB\R14SP3\compopts.bat
->    COMPILER               = cl
->    Compiler flags:
         COMPFLAGS           = -c -Zp8 -G5 -W3 -nologo
         OPTIMFLAGS          = -O2 -DNDEBUG
         DEBUGFLAGS          = -Zi -Fd"bin\add.pdb"
         arguments           =  -Ibin
         Name switch         = /Fo
->    Pre-linking commands   =
->    LINKER                 = link
->    Link directives:
         LINKFLAGS           = kernel32.lib user32.lib gdi32.lib
advapi32.lib oleaut32.lib ole32.lib /LIBPATH:"C:\Program Files
\MATLAB_R14\extern\lib\win32\microsoft\msvc71" /nologo mclmcrrt.lib
         LINKFLAGSPOST       =
         Name directive      = "/out:bin\add.exe"
         File link directive =
         Lib. link directive =
         Rsp file indicator  = @
->    Resource Compiler      = rc /fo "bin\.res"
->    Resource Linker        =
----------------------------------------------------------------


--> "cl  -Ibin -c -Zp8 -G5 -W3 -nologo /FoC:
\DOCUME~1\Tommy_2\LOCALS~1\Temp\add_main.obj -I"C:\Program Files
\MATLAB_R14"\extern\include  -O2 -DNDEBUG bin\add_main.c"


  C:\PROGRAM FILES\MATLAB_R14\BIN\WIN32\\..\MEX.PL: Error: Compile of
'bin\add_main.c' failed.

-------------------

Any ideas what this error is corresponding to?

Thanks for the help,
Tommy

0
wheels619 (3)
2/22/2007 5:19:05 PM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
1109 Views

Similar Articles

[PageSpeed] 46

Reply: