The compiler error when using SharedMenory. cpp

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!
arch=computer('arch');
mexopts = sprintf('mex -v -O -%s', arch);
% 64-bit platform
if ~isempty(strfind(computer(),'64'))
mexopts = sprintf('%s -largeArrayDims ', mexopts);
end
BOOST_dir = 'F:\boost_1_59_0';
%include boost
%if ~isempty(strfind(computer(),'win'))
%BOOST_dir = 'F:\boost_1_59_0\interprocess\windows_shared_memory.hpp';
%else
% on Ubuntu: sudo aptitude install libboost-all-dev libboost-doc
% BOOST_dir = '/usr/include/';
%end
if ~exist(fullfile(BOOST_dir,'boost','interprocess','windows_shared_memory.hpp'), 'file')
error('%s\n%s\n', ...
'Could not find the BOOST library. Please edit this file to include the BOOST location', ...
'<BOOST_dir>\boost\interprocess\windows_shared_memory.hpp must exist');
end
mexopts = sprintf('%s -I''%s'' ', mexopts, BOOST_dir);
eval([mexopts, 'SharedMemory.cpp']);
SharedMemory.cpp
c:\program files\matlab\r2012a\bin\SharedMemStack.hpp(357) : warning C4267: '=' : 'size_t' 轉換為 'int',資料可能遺失
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) : 請參閱 '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) : 請參閱 '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) : 請參閱 '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) : 請參閱 'strcmpi' 的宣告
SharedMemory.cpp(327) : warning C4267: '引數' : 'size_t' 轉換為 'int',資料可能遺失
SharedMemory.cpp(455) : warning C4267: '引數' : 'size_t' 轉換為 'int',資料可能遺失
SharedMemory.cpp(461) : warning C4267: '引數' : 'size_t' 轉換為 'int',資料可能遺失
SharedMemory.cpp(473) : warning C4267: '引數' : 'size_t' 轉換為 'int',資料可能遺失
SharedMemory.cpp(546) : error C2027: 使用未定義型別 'mxArray_tag'
c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : 請參閱 'mxArray_tag' 的宣告
SharedMemory.cpp(546) : error C2227: '->data' 的左邊必須指向類別/結構/等位/泛型型別
SharedMemory.cpp(546) : error C2228: '.number_array' 的左邊必須有類別/結構/等位
SharedMemory.cpp(546) : error C2228: '.reserved5' 的左邊必須有類別/結構/等位
SharedMemory.cpp(547) : error C2027: 使用未定義型別 'mxArray_tag'
c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : 請參閱 'mxArray_tag' 的宣告
SharedMemory.cpp(547) : error C2227: '->data' 的左邊必須指向類別/結構/等位/泛型型別
SharedMemory.cpp(547) : error C2228: '.number_array' 的左邊必須有類別/結構/等位
SharedMemory.cpp(547) : error C2228: '.reserved6' 的左邊必須有類別/結構/等位
SharedMemory.cpp(548) : error C2027: 使用未定義型別 'mxArray_tag'
c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : 請參閱 'mxArray_tag' 的宣告
SharedMemory.cpp(548) : error C2227: '->data' 的左邊必須指向類別/結構/等位/泛型型別
SharedMemory.cpp(548) : error C2228: '.number_array' 的左邊必須有類別/結構/等位
SharedMemory.cpp(548) : error C2228: '.reserved6' 的左邊必須有類別/結構/等位
SharedMemory.cpp(584) : error C2027: 使用未定義型別 'mxArray_tag'
c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : 請參閱 'mxArray_tag' 的宣告
SharedMemory.cpp(584) : error C2227: '->data' 的左邊必須指向類別/結構/等位/泛型型別
SharedMemory.cpp(584) : error C2228: '.number_array' 的左邊必須有類別/結構/等位
SharedMemory.cpp(584) : error C2228: '.pdata' 的左邊必須有類別/結構/等位
SharedMemory.cpp(586) : error C2027: 使用未定義型別 'mxArray_tag'
c:\program files\matlab\r2012a\bin\SharedMemory.hpp(83) : 請參閱 'mxArray_tag' 的宣告
SharedMemory.cpp(586) : error C2227: '->data' 的左邊必須指向類別/結構/等位/泛型型別
SharedMemory.cpp(586) : error C2228: '.number_array' 的左邊必須有類別/結構/等位
SharedMemory.cpp(586) : error C2228: '.pimag_data' 的左邊必須有類別/結構/等位
SharedMemory.cpp(699) : warning C4267: '引數' : 'size_t' 轉換為 'int',資料可能遺失
SharedMemory.cpp(920) : warning C4267: '=' : 'size_t' 轉換為 'int',資料可能遺失
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'SharedMemory.cpp' failed

2 个评论

I do not know the answer to your question, but more information on the warning can be found at http://stackoverflow.com/questions/1964821/strcmpi-renamed-to-strcmpi
I have found part of answer here
but I still have some problems like warning C4267: 'Argument' :if 'size_t' is transformed to 'int',, data may be missed

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 External Language Interfaces 的更多信息

提问:

2015-10-2

编辑:

2015-10-3

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by