将MFC转换为控制台应用程序时出现问题,错误C2365重新定义 [英] Problem converting MFC to console application, error C2365 redefinition

查看:183
本文介绍了将MFC转换为控制台应用程序时出现问题,错误C2365重新定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将用于死锁检测的MFC应用程序转换为简单控制台应用程序.在此过程中,我发现许多错误,例如:

I am converting an MFC application for deadlock detection in to Simple console application. During this process I found many errors saying like:

error C2365: ''CmdLockMutex'' : redefinition; previous definition was ''enumerator''



我无法删除此错误.
如果有人可以在这方面帮助我,请.



I am unable to remove this error.
Kindly if someone could help me in this regard.

推荐答案

您已经多次定义了CmdLockMutex.也许您的#include文件有问题?这是MFC类,您没有将MFC链接到控制台应用程序吗?
You''ve defined CmdLockMutex more than once. Perhaps you''ve got an issue with your #include files ? Is this an MFC class and you''ve not got MFC linked to your console app ? Hard to say more without seeing code.


听起来像您需要对CmdLockMutex定义周围的标头保护(在.h文件顶部添加一次#pragma). .或更确切地说,您存在命名冲突.



也许你有这样的东西:


Sounds like you need a header guard around your definition of `CmdLockMutex` (Add `#pragma once` at the top of its .h file.). Or rather you have a naming conflict.



Maybe you have something like this:


enum MyEnum { MyEnumVal1, MyEnumVal2 };

//....

class MyEnum
{
    
};


这篇关于将MFC转换为控制台应用程序时出现问题,错误C2365重新定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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