问题:
在使用 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
…
本文解决了一个在VS2008SP1与Matlab2009a混合编程中遇到的编译错误问题。原因是VS2008默认设置的系统平台最低要求为Vista系统,而在XP系统下会出现错误。通过修改targetver.h头文件中的WINVER定义可以解决此问题。
2718





