Matlab+VC混合编程的mclmcr.h重复定义错误解决方法

来源:互联网 发布:最新京东秒杀软件 编辑:程序博客网 时间:2024/05/21 17:46

问题:

在使用 VS2008 SP1 与 Matlab2009a  混合编程时遇到如下编译错误:
1>------ Build started: Project: testsincplot_dll, Configuration: Debug Win32 ------
1>Compiling...
1>testsincplot_dll.cpp
1>d:/program files/matlab/r2009a/extern/include/mclmcr.h(1722) : error C2011: '_INTERFACE_INFO' : 'struct' type redefinition
1>        c:/program files/microsoft sdks/windows/v6.0a/include/ws2ipdef.h(84) : see declaration of '_INTERFACE_INFO'

原因:

VS2008默认设置系统平台的最低要求是 Vista 系统,如果是 XP 系统,就会出现上述错误。

解决方法:

打开项目文件夹中的 targetver.h 头文件,把其中的 0X0600 修改为 0X0501,即:

#define WINVER 0x0600 ===>> #define WINVER 0x0501

#define _WIN32_WINNT 0x0600 ===>> #define _WIN32_WINNT 0x0501