Compiling C file in Matlab with Visual Studio

安稳与你 提交于 2019-12-12 03:17:59

问题


I have a C-File that I wanna compile in Matlab with MS Visual Studio 10. For that I use the following command:

mex -v test.c

The output that I get after compilation is the following:

test.c 
    Contents of C:\Temp\mex_kpuu4t\mex_tmp.rsp: 
    C:\Temp\mex_kpuu4t\test.obj 


--> link /out:"test.mexw64" /dll /export:mexFunction /MAP /LIBPATH:"C:\Program Files\MATLAB\R2011a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /implib:"C:\Temp\mex_kpuu4t\templib.x" /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  @C:\Temp\mex_kpuu4t\mex_tmp.rsp   

Microsoft (R) Incremental Linker Version 10.00.30319.01 
Copyright (C) Microsoft Corporation.  All rights reserved. 

C:\Temp\mex_kpuu4t\test.obj  
LINK : fatal error LNK1104: cannot open file 'test.mexw64' 

C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Link of 'test.mexw64' failed. 

Anyone an idea what could go wrong here? The interesting thing is, that the test.obj file seems not to be written to the temp folder, could that be the issue here?

Many thanks!


回答1:


Maybe you called "test" from a previously compiled mex? If yes, it might still be loaded to Matlab's memory, and cannot be overwritten. Try:

clear mex

and then compile again.



来源:https://stackoverflow.com/questions/8914371/compiling-c-file-in-matlab-with-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!