VC++6.0使用GDI++出现'ULONG_PTR'未定义和'token' 未定义的解决办法
2012-02-03 11:32
701 查看
VC++6.0使用GDI++出现'ULONG_PTR'未定义和'token' 未定义的解决办法
http://hi.baidu.com/programpad/blog/item/5e479f4dfd58a8f1d62afc45.html
2009-04-16 18:20
在引用gdiplus头文件之前声明,#define ULONG_PTR ULONG,既可
http://hi.baidu.com/programpad/blog/item/5e479f4dfd58a8f1d62afc45.html
2009-04-16 18:20
在引用gdiplus头文件之前声明,#define ULONG_PTR ULONG,既可
昨天有朋友说按照我的另一篇文章《[原创]在VC++6.0中如何使用GDI+》的方法使用GDI++,但是会出现错误,我看了看他发来的程序,报的错误是这样的: 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中的定义相冲突,所以,会出现此问题。 解决办法:添加#define ULONG_PTR ULONG ,具体如下: #pragma comment(lib, "gdi//gdiplus.lib") #define ULONG_PTR ULONG #include "gdi/GdiPlus.h" using namespace Gdiplus; 由于疏忽,忘记在那篇文章中写清,抱歉,如以往的所有文章出现问题,请将问题发到我的邮箱:liuzairenjian@163.com |
相关文章推荐
- 使用Asp.net Ajax时出现'Sys'未定义错误的解决办法
- 使用AJAX时出现“Microsoft JScript 运行时错误: 'Sys' 未定义”提示的解决方法
- VM中使用svn检出代码出现Password for '(null)' GNOME keyring问题的解决办法
- E2015 Ambiguity between 'ULONG_PTR' and 'Wmplib_tlb::ULONG_PTR' 这个错误怎么解决?终极解决办法
- U-Boot中使用tftp下载文件出现错误TFTP error: 'Access violation' (2)的解决办法
- Django出现的'ascii' codec can't encode characters in position...的解决办法
- Spring中使用proxool连接池的配置方式与出现Attempt to refer to a unregistered pool by its alias 'ums'异常的解决办法
- 在asp.net中使用ajax时出现的"'Sys' 未定义"的解决方法
- virtualbox挂载时出现 mount: unknown filesystem type 'vboxsf' 的解决办法
- Linux出现cp: preserving permissions for `filename': Operation not supported错误及解决办法
- 使用jfreechart画图时,出现错误 Null 'key' argument的解决方法
- Linux rar 安装出现rar: /lib/i686/nosegneg/libc.so.6: version `GLIBC_2.7' not found (required by rar) 的解决办法
- android NDK开发编译C++文件出现Type 'jint' could not be resolved和Unresolved inclusion: <jni.h>的解决办法
- iOS运行虚拟器时出现The file "XXX" couldn't be opened because you don't have permission to view it的解决办法
- 基于QWidget类的动态库在4.8.1隐式调用时出现staticMetaObject' of dllimport'd class的解决办法
- "在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的。如果在 IIS 中没有将虚拟目录配置为应用程序,则可能导致此错误"的解决方法
- VC++6.0原始套接字出现 C2065:'SIO_RCVALL' : undeclared identifier错误的解决方法
- 编写Wince的APP时出现 'User Stack Overflow' 异常的解决办法
- 出现"Unable to instantiate Action,xxxxx, defined for 'login' in namespace '/' xxxxx 解决办法
- vtk使用过程中出现 "no override found for ***"错误的解决办法