作者:朱金灿
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,如果有,请把它删除掉。
4.在编译VC工程(该工程链接m文件生成的库)时出现一个编译错误:错误 1 error C3861: “mclInitializeApplication_proxy”: 找不到标识符 d:\src\changedetect\processdata2\processdata2.cpp 31 ProcessData2
解决办法是:将#include <mclmcr.h>注释掉,改为包含mclmcrrt.h,对mclInitializeApplication函数进行前置声明,具体代码如下:
//#include "mclmcr.h"
#include <mclmcrrt.h>
EXTERN_C bool mclInitializeApplication(const char** options, size_t count);