在VC ++ 2010中重新定义错误C2365 [英] Error C2365 redefine in VC++ 2010

查看:208
本文介绍了在VC ++ 2010中重新定义错误C2365的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
我有一个这样的枚举

Hi all.
I have an enum like that

enum Dmode {
        select,
        place,
        place,
        text,
        paste 
};



我在所有课程之外将其声明为一种新类型.当我在VC ++ 2005中构建它时,就可以了.但是在VC ++ 2010中,编译器报告说



I declared it as a new type, outside all my classes. When I built it in VC++ 2005, it''s ok. But in VC++2010, the compiler reports that

error C2365: 'select' : redefinition; previous definition was 'function'
1>          c:\program files\microsoft sdks\windows\v7.0a\include\winsock2.h(1915) : see declaration of 'select'



与连接"相同
我的项目没有任何#include"winsock2.h"行.

如果您有任何解决方案,请给我.

非常感谢!

添加:我尝试将名称选择"更改为选择",该错误已消除,但是在我的项目中有很多地方使用了选择".我不想更改它:(



same to ''connect''
My project has not any #include "winsock2.h" line.

If you have any solution, please give me.

Thank you so much!

Add: I tried changing name ''select'' to ''select'', the error was removed, but in my project has so many place I used ''select''. I don''t want to change it :(

推荐答案

两件事:
1.您可能没有直接包含#include winsock2.h,但是您DID #include的其他文件又通过另一个#include直接或间接包含了它. (在我的系统上快速搜索,在包含目录中显示了21个包含"winsock2.h"的文件.)
2.如果要重复使用与系统名称冲突的名称,请考虑使用 ^ ]
另外,您可以在VS中使用Refactor/Rename命令对您的符号进行智能重命名.

彼得
Two things:
1. You may not have #included winsock2.h directly, but some other file you DID #include, included it in turn, either directly or indirectly through yet another #include. (A quick search on my system shows 21 files containing "winsock2.h" in the include directory.)
2. If you want to reuse names that conflict with system names, consider using namespaces[^]
Alternatively, you can use the Refactor/Rename command in VS to do an intelligent renaming of YOUR symbol.

Peter


这篇关于在VC ++ 2010中重新定义错误C2365的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆