Click here to Skip to main content
15,034,432 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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!


VB
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

>
Posted
Updated 3-Oct-15 4:26am
v3
Comments
Richard MacCutchan 2-Oct-15 4:38am
   
Unfortunately you left the message text in Chinese, so we do not know exactly what the problem is. Please translate to English before posting.
Member 12027464 3-Oct-15 9:59am
   
Sorry,I forgot it. I write as below because I cannot modify the question.
Patrice T 3-Oct-15 14:23pm
   
To edit your question, you have to click on the green Improve question at bottom on question

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.
   
v2
Comments
Member 12027464 3-Oct-15 9:25am
   
I just use the the code that are directly download from mathworks. Maybe the problems are from compiler?
Jochen Arndt 3-Oct-15 9:32am
   
I have not used Mathworks and can't tell you (especially without seeing the definitions). You may try to use a more recent Visual Studio version (the community editions are free). You may also check if Mathworks provides some documentation on using it with Visual Studio and which versions is recommended. Finally you may also get help from the Mathworks community (e.g. Matlab forum).
Member 12027464 3-Oct-15 9:58am
   
Because the Mathworks only supports compiler version several years before the matlab version, if you use the latest compiler version, it is out of work.
Jochen Arndt 3-Oct-15 10:36am
   
See my updated solution.
The key message is
C++
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'

So you need to include the header for this data object.

BTW: Warnings arent errors....
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900