[英]How to solve C++ MEX-file compilation error in Matlab R2018b with Windows 10, 64 bit?
I try to compile a C++ MEX-file in Matlab R2018b, but an error was occurred after compiling mex RegionGrowing_mex_modified.cpp
in the command window of Matlab. 錯誤是:
所以,我搜索並找到了這個鏈接,在做了建議之后, mex -compatibleArrayDims RegionGrowing_mex_modified.cpp
,MEX 成功完成了這個消息:
mex -compatibleArrayDims RegionGrowing_mex_modified.cpp
Building with 'MinGW64 Compiler (C++)'.
MEX completed successfully.
但不幸的是,在運行我的代碼時出現錯誤,錯誤是:
如何解決?
在您的源代碼中,您需要更改:
const int *pSize = mxGetDimensions(prhs[1]);
改為:
const mwSize *pSize = mxGetDimensions(prhs[1]);
您的代碼當前的方式是,您要求編譯器將指向 64 位 integer 的指針轉換為指向 32 位 integer 的指針,它正在抱怨這一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.