当我运行如下文件来设置sharedmemory时,有很多编译器错误,如何解决?谢谢!Windows version: Win7 64bitsMatlab version: R2012acomputer: 4 coresCompiler: Microsoft Visual C++ 2008 SP1When I run the file as below to set up sharedmemory, there are many compiler error, how to solve it? thanks!SharedMemory.cppc:\program files\matlab\r2012a\bin\SharedMemStack.hpp(357) : warning C4267: '=' : if 'size_t' is transformed to 'int',, data may be missedSharedMemory.cpp(125) : warning C4996: 'strcmpi': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strcmpi. See online help for details. C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(214) : please check the annoucenment of 'strcmpi'SharedMemory.cpp(177) : warning C4996: 'strcmpi': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strcmpi. See online help for details. C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(214) : please check the annoucenment of 'strcmpi'SharedMemory.cpp(231) : warning C4996: 'strcmpi': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strcmpi. See online help for details. C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(214) : please check the annoucenment of 'strcmpi'SharedMemory.cpp(262) : warning C4996: 'strcmpi': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strcmpi. See online help for details. C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(214) : please check the annoucenment of 'strcmpi'SharedMemory.cpp(327) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missedSharedMemory.cpp(455) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missedSharedMemory.cpp(461) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missedSharedMemory.cpp(473) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missedSharedMemory.cpp(546) : error C2027: Using undifined datatype 'mxArray_tag' c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : please check the annoucenment of 'mxArray_tag'SharedMemory.cpp(546) : error C2227: left of '->data' must point to class/struct/union/generic typeSharedMemory.cpp(546) : error C2228: left of '.number_array' must have class/struct/unionSharedMemory.cpp(546) : error C2228: left of '.reserved5' must have class/struct/unionSharedMemory.cpp(547) : error C2027: Using undifined datatype 'mxArray_tag' c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : please check the annoucenment of 'mxArray_tag'SharedMemory.cpp(547) : error C2227: left of '->data' must point to class/struct/union/generic typeSharedMemory.cpp(547) : error C2228: left of '.number_array' must have class/struct/unionSharedMemory.cpp(547) : error C2228: left of '.reserved6' must have class/struct/unionSharedMemory.cpp(548) : error C2027: Using undifined datatype 'mxArray_tag' c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : please check the annoucenment of 'mxArray_tag'SharedMemory.cpp(548) : error C2227: left of '->data' must point to class/struct/union/generic typeSharedMemory.cpp(548) : error C2228: left of '.number_array' must have class/struct/unionSharedMemory.cpp(548) : error C2228: left of '.reserved5' must have class/struct/unionSharedMemory.cpp(584) : error C2027: Using undifined datatype 'mxArray_tag' c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : please check the annoucenment of 'mxArray_tag'SharedMemory.cpp(584) : error C2227: left of '->data' must point to class/struct/union/generic typeSharedMemory.cpp(584) : error C2228: left of '.number_array' must have class/struct/unionSharedMemory.cpp(584) : error C2228: left of '.reserved5' must have class/struct/unionSharedMemory.cpp(586) : error C2027: Using undifined datatype 'mxArray_tag' c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : please check the annoucenment of 'mxArray_tag'SharedMemory.cpp(586) : error C2227: left of '->data' must point to class/struct/union/generic typeSharedMemory.cpp(586) : error C2228: left of '.number_array' must have class/struct/unionSharedMemory.cpp(586) : error C2027: Using undifined datatype 'mxArray_tag'SharedMemory.cpp(699) : warning C4267: 'Argument' : if 'size_t' is transformed to 'int',, data may be missedSharedMemory.cpp(920) : warning C4267: '=' : if 'size_t' is transformed to 'int',, data may be missed C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'SharedMemory.cpp' failed</boost_dir >>推荐答案错误位于 SharedMemory.cpp 的第546,547,548,584和586行,您使用的变量 mxArray_tag 。该变量的类型似乎在包含文件 SharedMemory.hpp 的第83行中定义。 请参阅MSDN错误说明错误(在输出窗口中选择错误编号或在线搜索时按F1键)。错误 C2027 [ ^ ]告诉你的类型变量未知。其他错误来自这个。 您应该向我们展示该变量的定义或自行检查。原因可能是另一个缺少的包含文件。 [更新] 我用google搜索了一下,发现丢失的 mxArray_tag 结构在 matrix.h 中定义(对于高达R2010A的Matlab版本)。请参见 http://undocumentedmatlab.com/blog/matlabs-internal-memory-representation/ [ ^ ]。 所以包括 matrix.h 可以解决错误。The errors are in the lines 546, 547, 548, 584, and 586 of SharedMemory.cpp where you are using the variable mxArray_tag. The type of that variable seems to be defined in line 83 of the include file SharedMemory.hpp.See the MSDN error description for the errors (press F1 when the error number is selected in the output window or search online). The error C2027[^] tells you that the type of the variable is not known. The other errors are sourced by this one.You should show us the definition of that variable or check it yourself. The reason may be another missing include file.[UPDATE]I googled a little bit and found that the missing mxArray_tag structure is defined in matrix.h (for Matlab versions up to R2010A). See http://undocumentedmatlab.com/blog/matlabs-internal-memory-representation/[^].So including matrix.h may solve the error.关键信息是The key message isSharedMemory.cpp(546) : error C2027: Using undifined datatype 'mxArray_tag' c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : please check the annoucenment of 'mxArray_tag' 因此,您需要包含此数据对象的标头。 BTW:警告不是错误....So you need to include the header for this data object.BTW: Warnings arent errors.... 这篇关于使用SharedMenory时的编译器错误。 CPP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-02 15:58