MATLAB: Boost mex compilation error > SharedMatrix

boostcompilationlccMATLABmexshared matrix

Hello, I use matlab a alot but not much C. I'm trying to use SharedMatrix ( http://www.mathworks.com/matlabcentral/fileexchange/28572-sharedmatrix). I downloaded the Boost library and tried to install/compile it with:
mex -v -O -win32 -I'C:\Program Files\boost\boost_1_51' SharedMemory.cpp
The exact output I get is:
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
****************************************************************************
-> Default options filename found in C:\Users\Skyhr\AppData\Roaming\MathWorks\MATLAB\R2012b
----------------------------------------------------------------
-> Options file = C:\Users\Skyhr\AppData\Roaming\MathWorks\MATLAB\R2012b\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2012b
-> COMPILER = lcc
-> Compiler flags:
COMPFLAGS = -c -I"C:\Program Files\MATLAB\R2012b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup
OPTIMFLAGS = -DNDEBUG
DEBUGFLAGS = -g4
arguments = -I"C:\Program Files\boost\boost_1_51"
Name switch = -Fo
-> Pre-linking commands =
-> LINKER = lcclnk
-> Link directives:
LINKFLAGS = -tmpdir "." -dll "C:\Program Files\MATLAB\R2012b\extern\lib\win32\lcc\mexFunction.def" -L"C:\Program Files\MATLAB\R2012b\sys\lcc\lib" -libpath "C:\Program Files\MATLAB\R2012b\extern\lib\win32\lcc" "C:\Users\Skyhr\AppData\Local\Temp\mex_7mGfwu\templib2.obj"
LINKDEBUGFLAGS =
LINKFLAGSPOST = libmx.lib libmex.lib libmat.lib
Name directive = -o "SharedMemory.mexw32"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = lrc -I"C:\Program Files\MATLAB\R2012b\sys\lcc\include" -noregistrylookup -fo"mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> lcc -I"C:\Program Files\boost\boost_1_51" -c -I"C:\Program Files\MATLAB\R2012b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -FoC:\Users\Skyhr\AppData\Local\Temp\mex_7mGfwu\SharedMemory.obj -I"C:\Program Files\MATLAB\R2012b\extern\include" -I"C:\Program Files\MATLAB\R2012b\simulink\include" -DNDEBUG -DMX_COMPAT_32 SharedMemory.cpp
lcc preprocessor error: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp:21 C:\Program Files\boost\boost_1_51\boost\interprocess\mapped_region.hpp:17 .\SharedMemStack.hpp:9 .\SharedMemory.hpp:92 SharedMemory.cpp:62 Could not find include file <cstddef>
lcc preprocessor error: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp:38 C:\Program Files\boost\boost_1_51\boost\interprocess\mapped_region.hpp:17 .\SharedMemStack.hpp:9 .\SharedMemory.hpp:92 SharedMemory.cpp:62 Could not find include file <utility>
lcc preprocessor error: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp:39 C:\Program Files\boost\boost_1_51\boost\interprocess\mapped_region.hpp:17 .\SharedMemStack.hpp:9 .\SharedMemory.hpp:92 SharedMemory.cpp:62 Could not find include file <memory>
lcc preprocessor error: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp:40 C:\Program Files\boost\boost_1_51\boost\interprocess\mapped_region.hpp:17 .\SharedMemStack.hpp:9 .\SharedMemory.hpp:92 SharedMemory.cpp:62 Could not find include file <functional>
lcc preprocessor error: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp:41 C:\Program Files\boost\boost_1_51\boost\interprocess\mapped_region.hpp:17 .\SharedMemStack.hpp:9 .\SharedMemory.hpp:92 SharedMemory.cpp:62 Could not find include file <iosfwd>
lcc preprocessor error: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp:42 C:\Program Files\boost\boost_1_51\boost\interprocess\mapped_region.hpp:17 .\SharedMemStack.hpp:9 .\SharedMemory.hpp:92 SharedMemory.cpp:62 Could not find include file <string>
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 28 syntax error; found `boost' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 28 syntax error; found `{' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 28 skipping `{'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 29 syntax error; found `intrusive' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 29 syntax error; found `{' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 29 skipping `{' `}' `}'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 32 syntax error; found `boost' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 32 syntax error; found `{' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 32 skipping `{'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 33 syntax error; found `interprocess' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 33 syntax error; found `{' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 33 skipping `{'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 34 syntax error; found `bi' expecting `;'
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 34 initializer must be constant
Error SharedMemory.cpp: C:\Program Files\boost\boost_1_51\boost\interprocess\interprocess_fwd.hpp: 34 too many errors
C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'SharedMemory.cpp' failed.
Could you please
  1. Explain the error to me.
  2. How do I fix this? I have used code that supposedly many people have successfully used. Why would these errors come up on my machine?

Best Answer

The supplied lcc compiler is a C compiler only, not a C++ compiler. You will not be able to compile cpp files with lcc. You need to install and select a C++ compiler to compile cpp files.
Related Question