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)容還不錯,歡迎將生活随笔推薦給好友。