使用Visual Studio在Matlab中编译C文件 [英] Compiling C file in Matlab with Visual Studio

查看:384
本文介绍了使用Visual Studio在Matlab中编译C文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要在MS Visual Studio 10的Matlab中编译的C文件. 为此,我使用以下命令:

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. 

任何人都知道这里可能出什么问题吗?有趣的是,似乎没有将test.obj文件写入temp文件夹,这可能是这里的问题吗?

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?

非常感谢!

推荐答案

也许您从以前编译的混合器中调用了测试"?如果是,它可能仍会加载到Matlab的内存中,并且不能被覆盖.试试:

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

,然后再次编译.

这篇关于使用Visual Studio在Matlab中编译C文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆