使用SharedMenory时的编译器错误。 CPP [英] The compiler error when using SharedMenory. cpp

查看:103
本文介绍了使用SharedMenory时的编译器错误。 CPP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows版本:Win7 64位

Matlab版本:R2012a

计算机:4核
编译器:Microsoft Visual C ++ 2008 SP1
当我运行如下文件来设置sharedmemory时,有很多编译器错误,如何解决?谢谢!





Windows version: Win7 64bits
Matlab version: R2012a
computer: 4 cores
Compiler: Microsoft Visual C++ 2008 SP1
When I run the file as below to set up sharedmemory, there are many compiler error, how to solve it? thanks!


SharedMemory.cpp
c:\program files\matlab\r2012a\bin\SharedMemStack.hpp(357) : warning C4267: '=' : if 'size_t' is transformed to 'int',, data may be missed
SharedMemory.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 missed
SharedMemory.cpp(455) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missed
SharedMemory.cpp(461) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missed
SharedMemory.cpp(473) : warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missed
SharedMemory.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 type
SharedMemory.cpp(546) : error C2228: left of '.number_array' must have class/struct/union
SharedMemory.cpp(546) : error C2228: left of '.reserved5' must have class/struct/union
SharedMemory.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 type
SharedMemory.cpp(547) : error C2228: left of '.number_array' must have class/struct/union
SharedMemory.cpp(547) : error C2228: left of '.reserved6' must have class/struct/union
SharedMemory.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 type
SharedMemory.cpp(548) : error C2228: left of '.number_array' must have class/struct/union
SharedMemory.cpp(548) : error C2228: left of '.reserved5' must have class/struct/union
SharedMemory.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 type
SharedMemory.cpp(584) : error C2228: left of '.number_array' must have class/struct/union
SharedMemory.cpp(584) : error C2228: left of '.reserved5' must have class/struct/union
SharedMemory.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 type
SharedMemory.cpp(586) : error C2228: left of '.number_array' must have class/struct/union
SharedMemory.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 missed
SharedMemory.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/ [< a href =http://undocumentedmatlab.com/blog/matlabs-internal-memory-representation/target =_ blanktitle =New Window> ^ ]。



所以包括 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 is
SharedMemory.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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆