error C2872: “Font”: 不明确的符号

在VS2010中调用GDI+时,

Font font(&fontFamily,24,FontStyleRegular,UnitPixel);

会提示提示“Font”: 不明确的符号的问题

1>          可能是“c:/program files/microsoft visual studio 10.0/vc/include/comdef.h(312) : Font”
1>          或       “c:/program files/microsoft sdks/windows/v7.0a/include/gdiplusheaders.h(244) : Gdiplus::Font”

解决方法:

把#include <GdiPlus.h>
#pragma comment(lib, "gdiplus.lib")

using namespace Gdiplus;

放到系统的头文件之前才行,

原错误代码修改为Gdiplus::Font font(&fontFamily,24,FontStyleRegular,UnitPixel);

posted @ 2015-09-09 19:26  星空天宇  阅读(421)  评论(0编辑  收藏  举报