来源:http://bbs.csdn.net/topics/370170739
问题:
小弟最近学习关于GDI+的编程。。
关于vs2008的配置问题。
百度搜索了相关配置,但是貌似都不起作用啊。
将include lib等文件都放入vs2008的安装目录里面去了。
然后再stdafx.h里面添加gdiplus.h头文件以及命名空间等,可是编译的时候出错啊。求指点。。
g:\visualstudio2008\vc\include\gdiplusenums.h(29) : error C2146: 语法错误 : 缺少“;”(在标识符“GraphicsState”的前面)
1>g:\visualstudio2008\vc\include\gdiplusenums.h(29) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>g:\visualstudio2008\vc\include\gdiplusenums.h(29) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>g:\visualstudio2008\vc\include\gdiplusenums.h(532) : error C2146: 语法错误 : 缺少“;”(在标识符“ObjectTypeIsValid”的前面)
1>g:\visualstudio2008\vc\include\gdiplusenums.h(532) : error C2433: “BOOL”: 不允许在数据声明中使用“inline”
1>g:\visualstudio2008\vc\include\gdiplusenums.h(532) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>g:\visualstudio2008\vc\include\gdiplusenums.h(535) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>g:\visualstudio2008\vc\include\gdiplusenums.h(558) : error C2065: “META_SETBKCOLOR”: 未声明的标识符
1>g:\visualstudio2008\vc\include\gdiplusenums.h(558) : error C2056: 非法表达式
1>g:\visualstudio2008\vc\include\gdiplusenums.h(559) : error C2065: “META_SETBKMODE”: 未声明的标识符
1>g:\visualstudio2008\vc\include\gdiplusenums.h(559) : error C2056: 非法表达式
1>g:\visualstudio2008\vc\include\gdiplusenums.h(560) : error C2065: “META_SETMAPMODE”: 未声明的标识符
1>g:\visualstudio2008\vc\include\gdiplusenums.h(560) : error C2056: 非法表达式
1>g:\visualstudio2008\vc\include\gdiplusenums.h(561) : error C2065: “META_SETROP2”: 未声明的标识符
1>g:\visualstudio2008\vc\include\gdiplusenums.h(561) : error C2056: 非法表达式
1>g:\visualstudio2008\vc\include\gdiplusenums.h(562) : error C2065: “META_SETRELABS”: 未声明的标识符
1>g:\visualstudio2008\vc\include\gdiplusenums.h(562) : error C2056: 非法表达式
1>g:\visualstudio2008\vc\include\gdiplusenums.h(563) : error C2065: “META_SETPOLYFILLMODE”: 未声明的标识符
解决:
在 stdAfx.h中加入
#include <comdef.h>