What information does the "-v" flag give me about my MEX, MBUILD, or MCC command?

3 views (last 30 days)
I would like to know what information the "-v" flag gives me about my MEX, MBUILD, or MCC command.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Jan 2010
The "-v" flag for MCC, MBUILD, and MEX causes these commands to be more verbose, and display more information about their progress --- for example, which C/C++/Fortran/Java compiler is being used, what options are being passed to that compiler, and what temporary files are being used.
For more information on which items are reported by which functions, see the relevant documentation:
doc mcc
doc mbuild
doc mex
In this example, we will use MCC -v, but the following information can be applied to any of the other "-v" commands. This example uses the MATLAB Compiler 2.1 (R12); other versions will report slightly different information.
mcc -v -m hello.m
The first section of output, shown below, is only seen in MCC (not MEX or MBUILD). This shows exactly what MATLAB files the MATLAB Compiler translated and their corresponding C or C++ files:
Compiler version: 2.1
Parsing file "D:\Applications\matlabr12\extern\examples\compiler\hello.m"
(Referenced from: "Compiler Command Line").
Generating file "hello.h".
Generating file "hello.c".
Generating file "hello_main.c".
The next output shows the exact command that MCC is executing to call MBUILD. If we had used "-x" instead of "-m" in our command, MCC would call MEX here (instead of MBUILD).
Executing command: mbuild -O -v -output 'hello' 'hello.c' 'hello_main.c' -link exe.
The following is exactly what you would see if you ran the above MBUILD command. The first two lines of output here are especially important:
-> Default options filename found in C:\WINNT\Profiles\jfouche\Application Data\MathWorks\MATLAB\R12
----------------------------------------------------------------
-> Options file = C:\WINNT\Profiles\jfouche\Application Data\MathWorks\MATLAB\R12\compopts.bat
These lines tell us the name and location of the options file that is being used to perform this compilation. In general it is not necessary to edit the options file, but if you needed to change any of the following settings, you could.
The following settings correspond exactly to what is in the options file listed above:
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = -c -Zp8 -G5 -W3 -nologo
OPTIMFLAGS = -O2 -DNDEBUG
DEBUGFLAGS = -Zi -Fd"hello.pdb"
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = kernel32.lib user32.lib gdi32.lib /LIBPATH:"D:\Applications\matlabr12\extern\lib\win32\microsoft\msvc60" libmmfile.lib libmatlb.lib /nologo libmx.lib libmat.lib sgl.lib libmwsglm.lib
Name directive = "/out:hello.exe"
File link directive =
Lib. link directive =
Rsp file indicator = @
----------------------------------------------------------------
Finally, the next few lines are the exact command-line statements passed into your C or C++ compiler. If you want to emulate the behavior of any of these scripts with an unsupported compiler, you can look at these lines and determine exactly what must be done in order to compile.
--> "cl -c -Zp8 -G5 -W3 -nologo /Fohello.obj -ID:\Applications\matlabr12\extern\include -ID:\Applications\matlabr12\simulink\include -O2 -DNDEBUG hello.c"
hello.c
--> "cl -c -Zp8 -G5 -W3 -nologo /Fohello_main.obj -ID:\Applications\matlabr12\extern\include -ID:\Applications\matlabr12\simulink\include -O2 -DNDEBUG hello_main.c"
hello_main.c
Contents of 5496_tmp.rsp:
hello.obj hello_main.obj
--> "link "/out:hello.exe" kernel32.lib user32.lib gdi32.lib /LIBPATH:"D:\Applications\matlabr12\extern\lib\win32\microsoft\msvc60" libmmfile.lib libmatlb.lib /nologo libmx.lib libmat.lib sgl.lib libmwsglm.lib @5496_tmp.rsp "
--> "if exist _lib5496.def del _lib5496.def"

More Answers (0)

Categories

Find more on Manage Products in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!