日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

VC++6.0使用GDI++出现'ULONG_PTR'未定义和'token' 未定义的解决办法

發(fā)布時間:2025/3/20 c/c++ 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VC++6.0使用GDI++出现'ULONG_PTR'未定义和'token' 未定义的解决办法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
VC++6.0使用GDI++出現(xiàn)'ULONG_PTR'未定義和'token' 未定義的解決辦法 http://hi.baidu.com/programpad/blog/item/5e479f4dfd58a8f1d62afc45.html
2009-04-16 18:20

在引用gdiplus頭文件之前聲明,#define ULONG_PTR ULONG,既可



昨天有朋友說按照我的另一篇文章《[原創(chuàng)]在VC++6.0中如何使用GDI+》的方法使用GDI++,但是會出現(xiàn)錯誤,我看了看他發(fā)來的程序,報的錯誤是這樣的:

e:\codebox\monitor\gdi\gdiplusinit.h(39) : error C2065: 'ULONG_PTR' : undeclared identifier
e:\codebox\monitor\gdi\gdiplusinit.h(39) : error C2065: 'token' : undeclared identifier
e:\codebox\monitor\gdi\gdiplusinit.h(39) : error C2165: 'left-side modifier' : cannot modify pointers to data
e:\codebox\monitor\gdi\gdiplusinit.h(39) : error C2071: 'NotificationHookProc' : illegal storage class
e:\codebox\monitor\gdi\gdiplusinit.h(40) : error C2146: syntax error : missing ')' before identifier 'token'
e:\codebox\monitor\gdi\gdiplusinit.h(40) : error C2165: 'left-side modifier' : cannot modify pointers to data
e:\codebox\monitor\gdi\gdiplusinit.h(40) : error C2071: 'NotificationUnhookProc' : illegal storage class
e:\codebox\monitor\gdi\gdiplusinit.h(40) : error C2059: syntax error : ')'
e:\codebox\monitor\gdi\gdiplusinit.h(91) : error C2059: syntax error : 'const'
e:\codebox\monitor\gdi\gdiplusinit.h(97) : error C2146: syntax error : missing ')' before identifier 'token'
e:\codebox\monitor\gdi\gdiplusinit.h(97) : warning C4229: anachronism used : modifiers on data are ignored
e:\codebox\monitor\gdi\gdiplusinit.h(97) : error C2182: 'GdiplusShutdown' : illegal use of type 'void'
e:\codebox\monitor\gdi\gdiplusinit.h(97) : error C2059: syntax error : ')'
e:\codebox\monitor\monitornetwork.h(23) : error C2146: syntax error : missing ';' before identifier 'm_pGdiToken'
e:\codebox\monitor\monitornetwork.h(23) : error C2501: 'ULONG_PTR' : missing storage-class or type specifiers
e:\codebox\monitor\monitornetwork.h(23) : error C2501: 'm_pGdiToken' : missing storage-class or type specifiers
E:\codebox\monitor\MonitorNetWork.cpp(133) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
E:\codebox\monitor\MonitorNetWork.cpp(171) : error C2065: 'm_pGdiToken' : undeclared identifier

問題原因:GDI++是WIndows Platform SDK不是MFC的一部分,而ULONG_PTR在SDK中的定義與MFC中的定義相沖突,所以,會出現(xiàn)此問題。

解決辦法:添加#define ULONG_PTR ULONG ,具體如下:

#pragma comment(lib, "gdi//gdiplus.lib")
#define ULONG_PTR ULONG

#include "gdi/GdiPlus.h"
using namespace Gdiplus;

由于疏忽,忘記在那篇文章中寫清,抱歉,如以往的所有文章出現(xiàn)問題,請將問題發(fā)到我的郵箱:liuzairenjian@163.com

與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的VC++6.0使用GDI++出现'ULONG_PTR'未定义和'token' 未定义的解决办法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。