WinDef.h 中的 tagRECT无法识别

xiehuanxie 2010-03-26 02:06:06
我们公司的一个VC。NET程序, 一个同事使用了RECT来作为变量, 在他的电脑上和另外一台电脑上编译都能通过。
但是到了我这就会有编译错误。
Error 1 error C2065: 'RECT' : undeclared identifier

试了以下的办法都不行:
1. 重新定义RECT。

struct RECT
{ int left; int top; int right; int bottom; };

在我电脑上是好了, 但是到他那会有编译错误:
error C2371: 'RECT' : redefinition; different basic types

2. 引用WinDef.h

#include "WinDef.h"

这时候会冒出10个winnt.h的编译错误

我们的机器环境都是一样的, 唯一的区别就是我开了Windows的自动更新, 但是想不出来什么情况会造成这种差别。
在RECT上按F12会出现两个Symbols, 一个是WinDef.h中的定义, 另一个是Sysmte::Windows::Forms::NativeMethods::RECT
如果是RECTL, 按F12会直接跳到WinDef.h中的定义, 但是一样不能识别。

有没有办法解决这个编译错误, 或者使用什么来代替RECT?
...全文
201 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiehuanxie 2010-03-30
  • 打赏
  • 举报
回复
问题解决了, 要把 #include <windows.h> 写在最上面的位置。
cnzdgs 2010-03-29
  • 打赏
  • 举报
回复
先#include,后using。
cnzdgs 2010-03-29
  • 打赏
  • 举报
回复
在FILETIME上F12看看哪些地方定义了这个标号.
xiehuanxie 2010-03-29
  • 打赏
  • 举报
回复
加完之后winbase.h等出现编译错误

Error 2 error C2872: 'FILETIME' : ambiguous symbol C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h 4389
真相重于对错 2010-03-26
  • 打赏
  • 举报
回复
#include <windows.h>
从SourceForge上Dump下来的MinGW最新版5.0.X完整版,涵盖完整迁移库,值得拥有。 完整可引入header列表: \MINGW\INCLUDE │ accctrl.h │ aclapi.h │ aclui.h │ adsprop.h │ afxres.h │ amaudio.h │ amvideo.h │ assert.h │ audevcod.h │ autosprintf.h │ aviriff.h │ aygshell.h │ basetsd.h │ basetyps.h │ bdatypes.h │ cderr.h │ cguid.h │ cmnquery.h │ comcat.h │ commctrl.h │ commdlg.h │ complex.h │ conio.h │ control.h │ cpl.h │ cplext.h │ ctype.h │ custcntl.h │ d3d9.h │ d3d9caps.h │ d3d9types.h │ dbt.h │ dde.h │ ddeml.h │ devguid.h │ dhcpcsdk.h │ dir.h │ direct.h │ dirent.h │ dlfcn.h │ dlgs.h │ docobj.h │ dos.h │ dsadmin.h │ dsclient.h │ dsgetdc.h │ dshow.h │ dsquery.h │ dsrole.h │ dvdevcod.h │ dvdmedia.h │ dxerr8.h │ dxerr9.h │ edevdefs.h │ errno.h │ errorrep.h │ errors.h │ evcode.h │ excpt.h │ exdisp.h │ exdispid.h │ fcntl.h │ fenv.h │ float.h │ fltdefs.h │ gdiplus.h │ getopt.h │ gettext-po.h │ glob.h │ gmon.h │ httpext.h │ icm.h │ iconv.h │ idispids.h │ il21dec.h │ imagehlp.h │ imm.h │ initguid.h │ intshcut.h │ inttypes.h │ io.h │ ipexport.h │ iphlpapi.h │ ipifcons.h │ ipinfoid.h │ iprtrmib.h │ iptypes.h │ ipxconst.h │ ipxrtdef.h │ ipxtfflt.h │ isguids.h │ ks.h │ ksmedia.h │ largeint.h │ libcharset.h │ libgen.h │ libintl.h │ limits.h │ lm.h │ lmaccess.h │ lmalert.h │ lmapibuf.h │ lmat.h │ lmaudit.h │ lmbrowsr.h │ lmchdev.h │ lmconfig.h │ lmcons.h │ lmerr.h │ lmerrlog.h │ lmmsg.h │ lmremutl.h │ lmrepl.h │ lmserver.h │ lmshare.h │ lmsname.h │ lmstats.h │ lmsvc.h │ lmuse.h │ lmuseflg.h │ lmwksta.h │ localcharset.h │ locale.h │ ltdl.h │ lzexpand.h │ malloc.h │ mapi.h │ math.h │ mbctype.h │ mbstring.h │ mciavi.h │ mcx.h │ mem.h │ memory.h │ mgm.h │ mgmtapi.h │ mlang.h │ mmreg.h │ mmsystem.h │ mpegtype.h │ mprapi.h │ mq.h │ msacm.h │ mshtml.h │ msvcrtver.h │ mswsock.h │ nb30.h │ nddeapi.h │ nspapi.h │ ntdef.h │ ntdll.h │ ntdsapi.h │ ntdsbcli.h │ ntldap.h │ ntsecapi.h │

7,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧