我使用matlab很多但不是太多C(我稍后会介绍)。我正在尝试安装名为SharedMatrix的mex文件。安装需要Boost的进程间库。
要在Matlab上安装SharedMatrix,我输入:
mex -v -O -win32 -I'C:\Program Files\boost\boost_1_51' SharedMemory.cpp
我得到的确切输出是:
***************************************************************************
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_5NkIuB\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_5NkIuB\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.
你能取悦吗?
1.解释错误
2.我该如何解决这个问题?
答案 0 :(得分:0)
在您的系统上mex
配置为使用 lcc 编译器,它是一个C编译器。 Boost是一个C ++库;所以你不能使用 lcc 编译使用Boost的程序。
运行mex -setup
并选择C ++编译器。
如果您没有安装任何其他编译器,则必须先安装一个。在Windows上,R2012B支持免费的Visual Studio 2010 Express Edition C ++编译器。下载并安装它,然后再次尝试运行mex
命令(运行mex -setup
后)。