matlab coder: Build error: Compilation returned error status code 2.

3 Ansichten (letzte 30 Tage)
HUST
HUST am 22 Mai 2014
Kommentiert: 超 陈 am 5 Jun. 2020
I want to use the MATLAB coder to transform a m file to a c file . But I always encounter the problem.
Here is the m file
function a = testfun(b,c)
a = b + c;
end
And the error report is : Build error: Compilation returned error status code 2. See the target build log in the report for further details.
Build log is : 13 link /dll /LIBPATH:"D:\SOFTWA~3\MATLAB~1\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"testfun_mex.x" /MAP:".\testfun_mex.mexw64.map" /NODEFAULTLIB:LIBCMT /OUT:testfun_mex.mexw64 testfun_initialize.obj testfun_terminate.obj testfun.obj testfun_api.obj testfun_mex.obj _coder_testfun_info.obj @testfun_mex_mex.arf 14 正在创建库 testfun_mex.x 和对象 testfun_mex.exp 15 'cmd' 不是内部或外部命令,也不是可运行的程序 16 或批处理文件。 17 gmake: * [testfun_mex.mexw64] Error 1
  1 Kommentar
zhenying qin
zhenying qin am 1 Okt. 2016
I encounter the same problem now.did you find the possible reasons for the results and solve it in the end?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Matthias
Matthias am 21 Aug. 2014
I had the same Problem. MATLAB could not find the cmd.exe in the system path. cmd.exe is located in C:\Windows\System32
Call the command "getenv PATH" and check if the path is present. If not use for instance http://www.mathworks.com/matlabcentral/answers/94933-how-do-i-set-my-system-path-under-windows to add it.
Hope this helps Matthias
  1 Kommentar
Hari Ijjada
Hari Ijjada am 28 Aug. 2019
i have did the same thing...i have changed the path ...but it is giving same error...what should i do ?

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 28 Aug. 2019
That software is not supported on versions of MS Windows before Windows XP.
  6 Kommentare
Hari Ijjada
Hari Ijjada am 30 Aug. 2019
yes...i had a problem with my PATH environment variable...i added the C/Windows/System32 to my path variable...now i am able to build the mex files..
i have resolved my issue succesfulluy...thank you so much your help
超 陈
超 陈 am 5 Jun. 2020
i had the same problem and i added the C/Windows/System32 to my path variable.but i stll did not solve the problem ,how could i do?
nvcc -Xlinker /nologo -Xlinker /manifest -Xlinker /export:mexFunction -Xlinker /DLL -L"D:\Program Files\MATLAB\R2017b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib -Xlinker /EXPORT:mexFunction -Xnvlink -w -Wno-deprecated-gpu-targets -Xlinker /NODEFAULTLIB:libcmt.lib -o fog_rectification_gpu_mex.mexw64 fog_rectification_data.obj fog_rectification_initialize.obj fog_rectification_terminate.obj fog_rectification.obj _coder_fog_rectification_info.obj _coder_fog_rectification_api.obj _coder_fog_rectification_mex.obj c_mexapi_version.obj -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64" cuda.lib cudart.lib cublas.lib cusolver.lib cufft.lib -Xlinker libemlrt.lib,libcovrt.lib,libut.lib,libmwmathutil.lib,/export:mexFunction,/export:emlrtMexFcnProperties,/export:fog_rectification,/export:fog_rectification_initialize,/export:fog_rectification_terminate,/export:fog_rectification_atexit
libmx.lib
libmex.lib
libmat.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
fog_rectification_data.obj
fog_rectification_initialize.obj
fog_rectification_terminate.obj
fog_rectification.obj
_coder_fog_rectification_info.obj
_coder_fog_rectification_api.obj
_coder_fog_rectification_mex.obj
c_mexapi_version.obj
cuda.lib
cudart.lib
cublas.lib
cusolver.lib
cufft.lib
正在创建库 fog_rectification_gpu_mex.lib 和对象 fog_rectification_gpu_mex.exp
'cmd' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
gmake: *** [fog_rectification_gpu_mex.mexw64] Error 1

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by