作者:朱金灿
来源:http://blog.csdn.net/clever101
1. error C2011: '_INTERFACE_INFO' : 'struct' type redefinition的问题。
对于VC 6.0工程,在StdAfx.h里的所有包含头文件之前添加下面两句代码:
#define WINVER 0x0501 #define _WIN32_WINNT 0x0501
对于VC 6.0以上的工程,则需要修改targetver.h,把其中的 0X0600 修改为 0X0501,即:
#define WINVER 0x0600 ===>> #define WINVER 0x0501
#define _WIN32_WINNT 0x0600 ===>> #define _WIN32_WINNT 0x0501
2.运行时出现__security_init_cookie的错误。
在集成mcc编译生成的库后运行出错,错误代码处为:
#if defined (_WIN64) cookie = systime.ft_scalar; #else /* defined (_WIN64) */ cookie = systime.ft_struct.dwLowDateTime; // 出错处 cookie ^= systime.ft_struct.dwHighDateTime; #endif /* defined (_WIN64) */
请重新运行mex -setup 和mbuild -setup两个命令对编译器进行配置。
3.在使用mcc工具对m文件进行编译时出现错误:
The file
'E:\MyApp\src\CombineDev\Matlab\mccdemo1.dll'
appears to be a MEX-file. It shadows the M-file
'E:\MyApp\src\CombineDev\Matlab\mccdemo1.m'
but will not execute properly at runtime, as it does not export a function named 'mexFunction.'
??? Error using ==> mcc
Error executing mcc, return status = 1 (0x1).
请确保存放你的m文件下没有对应的dll文件。比如你要编译E:\MyApp\src\CombineDev\Matlab\mccdemo1.m,请保证E:\MyApp\src\CombineDev\Matlab目录下对应生成的dll文件mccdemo1.dll,如果有,请把它删除掉。
参考文献:
1.Matlab+VC混合编程的mclmcr.h重复定义错误解决方法
2.Matlab------------GUI编程:mcc命令参数用法
3.使用MATLAB编译器实现混合编程