CObject 'class' type redefinition

Hi,
I couldn't figure out the errors and I've checked the MSDN. The error I've 
got is
error C2011: 'CObject': 'class' type redefinition

CObject was defined in Object.h
CObject.cpp includes CObject.h

And in the view class (MFC) as well
hence CMyView.h
when I comment out CMyView.h, it compiles okay
but I need access to CObject.h because I need to define several CObject 
Objects... What else can I do?

//////////////////////////////////////////////////////// CObject.h
#ifndef _OBJECT_H_
#define _OBJECT_H_

class CObject
{
protected:
 CPerformer*    m_pMA;
 DWORD     m_dwMultiAnimIdx;
 CMesh*     m_pAI;
 vector<CObject *>  *m_pv_pChars;
 CSoundManager*   m_pSM;
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////// CObject.cpp
#include "dxstdafx.h"
#include "AllocHierarchy.h"
#include "DSUtil.h"
#include "Object.h"

CObject::CObject()
{
}

CObject::~CObject()
{
 Cleanup();
}

void CObject::Cleanup()
{
}
/////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////CMyView.h
#include "dxstdafx.h"
#include "dsutil.h"
#include "AllocHierarchy.h"
#include "Object.h"
#include <queue>

class CMFCSimV6Build1View : public CView, public CD3DApplication
{
protected:
 CMyView();
 DECLARE_DYNCREATE(CMyView)


public:
 CMyDoc* GetDocument() const;
protected:
 HINSTANCE     m_hInstance;

 LPD3DXMESH     m_pMeshFloor;
 D3DXMATRIX     m_mxFloor;
 D3DMATERIAL9    m_MatFloor;
 LPDIRECT3DTEXTURE9   m_pTxFloor;

 ID3DXFont*     m_pFont;
 CFirstPersonCamera   m_Camera;
 float      m_fAspectRatio;
 CSoundManager    m_DSound;

 CPerformer     m_Lorry;   // inherit from CObject

 vector< CLorry* >   m_v_pLorry;        // have definition in the CObject 
class where CLorry is derived from CObject
////////////////////////////////////////////////////////////////////////////////


Thanks
Jack



0
jl1 (84)
11/1/2005 12:57:50 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
1141 Views

Similar Articles

[PageSpeed] 17

"Jack" <jl@knight.com> ���g��l��s�D:OJ87dPu3FHA.2872@TK2MSFTNGP15.phx.gbl...
> Hi,
> I couldn't figure out the errors and I've checked the MSDN. The error I've 
> got is
> error C2011: 'CObject': 'class' type redefinition
>
> CObject was defined in Object.h
> CObject.cpp includes CObject.h
>
> And in the view class (MFC) as well
> hence CMyView.h
> when I comment out CMyView.h, it compiles okay
No. Sorry, should be "comment out CObject.h"


> but I need access to CObject.h because I need to define several CObject 
> Objects... What else can I do?
>
> //////////////////////////////////////////////////////// CObject.h
> #ifndef _OBJECT_H_
> #define _OBJECT_H_
>
> class CObject
> {
> protected:
> CPerformer*    m_pMA;
> DWORD     m_dwMultiAnimIdx;
> CMesh*     m_pAI;
> vector<CObject *>  *m_pv_pChars;
> CSoundManager*   m_pSM;
> //////////////////////////////////////////////////////////////////////
>
> //////////////////////////////////////////////////////// CObject.cpp
> #include "dxstdafx.h"
> #include "AllocHierarchy.h"
> #include "DSUtil.h"
> #include "Object.h"
>
> CObject::CObject()
> {
> }
>
> CObject::~CObject()
> {
> Cleanup();
> }
>
> void CObject::Cleanup()
> {
> }
> /////////////////////////////////////////////////////////////////
> //////////////////////////////////////////////////////////CMyView.h
> #include "dxstdafx.h"
> #include "dsutil.h"
> #include "AllocHierarchy.h"
> #include "Object.h"
> #include <queue>
>
> class CMFCSimV6Build1View : public CView, public CD3DApplication
> {
> protected:
> CMyView();
> DECLARE_DYNCREATE(CMyView)
>
>
> public:
> CMyDoc* GetDocument() const;
> protected:
> HINSTANCE     m_hInstance;
>
> LPD3DXMESH     m_pMeshFloor;
> D3DXMATRIX     m_mxFloor;
> D3DMATERIAL9    m_MatFloor;
> LPDIRECT3DTEXTURE9   m_pTxFloor;
>
> ID3DXFont*     m_pFont;
> CFirstPersonCamera   m_Camera;
> float      m_fAspectRatio;
> CSoundManager    m_DSound;
>
> CPerformer     m_Lorry;   // inherit from CObject
>
> vector< CLorry* >   m_v_pLorry;        // have definition in the CObject 
> class where CLorry is derived from CObject
> ////////////////////////////////////////////////////////////////////////////////
>
>
> Thanks
> Jack
>
>
> 


0
jl1 (84)
11/1/2005 1:05:09 PM
"Jack" <jl@knight.com> ���g��l��s�D:OJ87dPu3FHA.2872@TK2MSFTNGP15.phx.gbl...
> Hi,
> I couldn't figure out the errors and I've checked the MSDN. The error I've 
> got is
> error C2011: 'CObject': 'class' type redefinition
>
> CObject was defined in Object.h
> CObject.cpp includes CObject.h
>
> And in the view class (MFC) as well
> hence CMyView.h
> when I comment out CMyView.h, it compiles okay
> but I need access to CObject.h because I need to define several CObject 
> Objects... What else can I do?
>
> //////////////////////////////////////////////////////// CObject.h
> #ifndef _OBJECT_H_
> #define _OBJECT_H_
>
> class CObject
> {
> protected:
> CPerformer*    m_pMA;
> DWORD     m_dwMultiAnimIdx;
> CMesh*     m_pAI;
> vector<CObject *>  *m_pv_pChars;
don't worry about this, I have commented this out too


> CSoundManager*   m_pSM;
> //////////////////////////////////////////////////////////////////////
>
> //////////////////////////////////////////////////////// CObject.cpp
> #include "dxstdafx.h"
> #include "AllocHierarchy.h"
> #include "DSUtil.h"
> #include "Object.h"
>
> CObject::CObject()
> {
> }
>
> CObject::~CObject()
> {
> Cleanup();
> }
>
> void CObject::Cleanup()
> {
> }
> /////////////////////////////////////////////////////////////////
> //////////////////////////////////////////////////////////CMyView.h
> #include "dxstdafx.h"
> #include "dsutil.h"
> #include "AllocHierarchy.h"
> #include "Object.h"
> #include <queue>
>
> class CMFCSimV6Build1View : public CView, public CD3DApplication
> {
> protected:
> CMyView();
> DECLARE_DYNCREATE(CMyView)
>
>
> public:
> CMyDoc* GetDocument() const;
> protected:
> HINSTANCE     m_hInstance;
>
> LPD3DXMESH     m_pMeshFloor;
> D3DXMATRIX     m_mxFloor;
> D3DMATERIAL9    m_MatFloor;
> LPDIRECT3DTEXTURE9   m_pTxFloor;
>
> ID3DXFont*     m_pFont;
> CFirstPersonCamera   m_Camera;
> float      m_fAspectRatio;
> CSoundManager    m_DSound;
>
> CPerformer     m_Lorry;   // inherit from CObject
>
> vector< CLorry* >   m_v_pLorry;        // have definition in the CObject 
> class where CLorry is derived from CObject
> ////////////////////////////////////////////////////////////////////////////////
>
>
> Thanks
> Jack
>
>
> 


0
jl1 (84)
11/1/2005 1:08:04 PM
Oh yeah, got it. Thanks
Jack

"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> 
???????:ucbQkou3FHA.3460@TK2MSFTNGP12.phx.gbl...
> Jack wrote:
>>>I couldn't figure out the errors and I've checked the MSDN. The error 
>>>I've got is
>>>error C2011: 'CObject': 'class' type redefinition
>
> Change your class name.  CObject is an MFC class.
>
> -- 
> Scott McPhillips [VC++ MVP]
> 


0
jl1 (84)
11/1/2005 1:55:50 PM
Jack wrote:
>>I couldn't figure out the errors and I've checked the MSDN. The error I've 
>>got is
>>error C2011: 'CObject': 'class' type redefinition

Change your class name.  CObject is an MFC class.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
11/1/2005 2:42:40 PM
Reply:

Similar Artilces:

What is this window type ?
Hi there, I couldn't find any info on google about this because I don't even know how you call that type of window. It's pretty basic, I have my active window and I want to use a second window but still be able to use the first one. When I create a dialog using the DoModal() I can't give control back to my main window... Can someone maybe only point out the type of window it is so I can check some info on the net how to use them ? Thanks, Max. Maxime Savard wrote: > Hi there, > > I couldn't find any info on google about this because I don't ...

Type unreadable when replying and forwarding
When I reply to an email my text becomes so light of a yellow color when the recipient opens it that they can not even read it. I have adjusted the default fonts to no avail. Anyone ever heard of this?? ...

Integration Manager
I have a single file integrations with a source file name that changes each time. I need to create a script that changes the datatype from an integer to double. Can someone offer advice on creating this script? how do you want to change the source filename? Do you want to select the file? the vb function CDbl will convert the datatype to double. I think you are asking the wrong question. What are you trying to do or wat is the problem? -- www.DynExtra.com A resource for the Microsoft Dynamics Community Featuring FAQs, File Exchange and more Current member count: 40 ----------------...

Word 2007
I am typing dates into a document. When I type 28 January 2010, a pop-up comes up with 2010-01-28 and suggests I hit Enter. As I do not want this suggestion I have to hit the space bar. I want to switch this off. How do I? It is driving me crazy. I thought it was in Auto Correct/Auto Format As You Type/Apply As You Type/Date Style. I switched that off but my problem is still there. Hi, There is no option in the Word 2007 user interface to turn this off, but there is a way to turn it off. Press Alt+F11. In the Visual Basic Editor, press Ctrl+G, which opens the Immediat...

why is the font so large when I type messages? how can I change
All of a sudden when I type my messages in OUtlook the font is very large and I cannot change it. I do nto know how it happend. Can anyone tell me how to get it back to normal please? I was told that the receiver sees the message in normal size font. thanks Jennie Have you checked your zoom level already? http://www.msoutlook.info/question/95 -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ Real World Questions, Real World Answers ---...

Update Field Data Type
I have a checkbox field for which I want to change the data type to a Number (Integer or Long Integer). I searched the discussion board and found the following suggested code: Dim strSql As String strSql = "ALTER TABLE MyTable ALTER MyField LONG;" DBEngine(0)(0).Execute strSql, dbFailOnError I ran the code and while it does successfully change the data type to LONG INTEGER, the Display Control property remains set at 106 (Check Box) and therefore the appearance of the field in datasheet view does not change. Could someone let me know how I would go a...

Activity type "Service Activity"
I understood that in ver 3.0, we were suppose to have control over the Activity types. How would I go about removing "service activity" from the types of Activity?I noticed that Activity type is a picklist, but is not editable. Then, I couldn't find anything in security to control the activity types. An article describing how to modify activities can be found here: http://www.microsoft.com/dynamics/crm/using/customizing/activities.mspx -- This posting is provided "AS IS" with no warranties, and confers no rights. "Nora" <Nora@discussions.mic...

CDbl and "Type mismatch"
Neither of these cases work. I just get a "Type mismatch" error. Dim deg(10), min(10), sec(10), DEGt(10) as Double deg(h) = CDbl(.Cells(2 + h, 3)) min(h) = CDbl(.Cells(2 + h, 4)) sec(h) = CDbl(.Cells(2 + h, 5)) DEGt(h) = deg(h) + min(h))/ 60 + sec(h) / 3600 or deg(h) = .Cells(2 + h, 3) min(h) = .Cells(2 + h, 4) sec(h) = .Cells(2 + h, 5)) DEGt(h) = CDbl(deg(h)) + CDbl(min(h)) / 60 + CDbl(sec(h)) / 3600 I'm guessing "h" is a loop variable... what values does it iterate over? Also, **exactly** what is in your cells that you are trying to convert (show ...

AJAX AutocompleteExtender does not work when type between delimeters
I have a multiline textbox attached with ajax autocomplete extender with "\n" as delimeter. When i type between these delimeters, the suggestion list does not appear. Eg. : hi //When i type between these lines of "hi" and "bye", the suggestionlist does not appear. bye If "," is used as delimeter then hi,"PROBLEM",bye suggestionlist does not appear between "hi" and "bye". I want the list to appear anywhere in between delimeters. Submitted via EggHeadCafe - Software Developer Portal of Choice ...

Adding new asset classes
Has anyone from MSFT comment on whether there will be support for adding new asset class to Money. Existing ones do not cover all classes and I dont see any option to add new ones. They don't make those kinds of comments before they ship product. I wouldn't hold my breath waiting were I you. Most of their investment seems to be directed toward the "Essentials" not useful stuff like this. <randv.randv@gmail.com> wrote in message news:1176182178.455300.213410@b75g2000hsg.googlegroups.com... > Has anyone from MSFT comment on whether there will be support for > ...

Importing From Excel
In Excel, any cell can contain any data, and the data may or may not be formatted in a particular way. In Access, by contrast, every field has a fixed data type and can only contain a value of that type ( double, text, etc.). When Access imports from Excel to a new table, it guesses the field types to use by examining the data in the first few rows of the Excel table - and often gets it wrong. This can cause Access to bomb out during the import. The "Fix" for this - according to another post, is to massage the data in the import. That is riciculous. Does anyone have a way to fix...

hook all function calls to a class
HI all, Hope this day is going well. If someone would care to add there $0.02 too a problem I am facing I would be very happy. My problem; I have a class, (lets call it) FooBar, and because it does a lot of funny interopts with various com instances it is esential that all calls made in my class to these com instances hapen on the same thread that created the comm instance. Unfortunatly for me my aplication is heavily multi threaded and I have several classes like foobar. I would like to create a class that inherits foobar, CooBarMk2 that adds an execution thread that is stat...

Fonts don't work when typing Russian characters.
Operating System: Mac OS X 10.6 (Snow Leopard) I have set up Russian as the second language I can type in on my mac. All the characters display correctly. However, only 2 or 3 basic fonts are available when the language is set to Russian. I realize that *most* fonts out there have not been converted to cyrillic characters, but from having Office before, I know that quite a few of them are (as in, a lot more than those that work for me). Is there a reason my mac does not recognize that they work for both languages? Can they be activated or downloaded? Any insight would be appreciated. On 2...

Different content types
Hello, At the moment I am working on a web application and I have a Assets table as follows: create table dbo.Assets ( Id int not null, Content varbinary(max) filestream constraint DF_Assets_Content default(0x), [Key] uniqueidentifier not null rowguidcol constraint U_Assets_Key unique, MimeId int not null, constraint PK_Assets primary key clustered(Id) ) -- Assets I am saving files, simple text, html code, etc. And I define what I am saving using the Mime type. Should I have two tables? Phrases for text format content (html, plain text, css, etc) and Files...

Object Access to XSD created Class Confusing
Maybe newbie question but I'm stumped after much search of google. Last week created class using xsd.exe against xsd file from well nested xml that rendered in part: .... _ Public Class MacroflowCatalog '<remarks/> <System.Xml.Serialization.XmlElementAttribute("MacroFlow")> _ Public Items() As MacroflowCatalogMacroFlow End Class .... I was then able to reference MacroflowCatalog.Items(0).MacroFlow(0)...more depth from here, using Intellisense. In other words, everthing mapped neatly into nested arrays from the xml pattern. This week I'm using...

VC++ DLL and Inserting classes
Questions: 1. Can you insert an already created derived class into a dll so that you can wrap its functions for export? If so, where do you do this in the IDE?? 2. Same question re bringing in the base class header file?? Thanks David This article shows how to do it: http://www.mindcracker.com/mindcracker/c_cafe/dll/extn_dll.asp Jaime "dw85745" <dw85745@gbronline.com> wrote in message news:uMKdnVhnbPpDU1rdRVn-gw@gbronline.com... > Questions: > > 1. Can you insert an already created derived class into a dll so that you > can wrap its functions for e...

Nested class using MFC
Hello! I'm using a COM Dll and a COM client that I have copied from a book. This COM dll is using MFC and the COM client exe file is also using MFC. I have removed some code just to make it easier to figure out my problem. The code that I have removed does't affect the question in any way. In the code you have one interface called IVisual you have it below. struct IVisual : public IUnknown { STDMETHOD_(void, Display) () = 0; }; As you know in Interface IUnknown are there three pure virtual functiones named QueryInterface, AddRef and Release. The functions QueryInterface, AddRef...

Transaction Type
Does Money 2005 permit the adding of a transaction type such as INST XFER, instrument transfer, so that I don't have to type it in every time. I use paypal and would like to have this option instead of debit, because the money comes out of my checking account. If not in 05, can you do it in '07? I don't believe anything changed in this area between 05 and 07 -- Michael Gordon "Rick Parker" <RickParker@discussions.microsoft.com> wrote in message news:ED60B835-5A42-4D18-A5F2-CCEC6438D2F7@microsoft.com... > Does Money 2005 permit the adding of a transaction...

<type your subject here>
<Type your message here> titi ...

Dynamic chart- curve dropping to zero ( chart type- Line)
Hi all i using following formula and description for the dynamic chart. Please do the needful In B1 = Project start date , C1= Mar-10 In B2= Project duration , C2= 30 ( which may vary) In B3= Project Cost , C3= 10000000 In C6=+IF(ROW()-ROW(C$6)+1<=C$2,DATE(YEAR(C$1),MONTH(C$1)+ROW()-ROW(C$6),DAY(C$1)),"") Till C50 In D5=IF(OR(B6="",B6=0),"",B6/$C$2) till d50 In e5=IF(OR(D6="",D6=0),"",IF(D6<=33.33%,(($I$1*D6^2)*100),IF(D6<=66.67%,($I$2*D6+$I$3),IF(D6>=66.67%,($I$4+$I$5*D6+$I$6*D6^2)*100,"")))), till E50 I...

static members in a class and threads
Two objects of the same class are instantiated in two threads separately. The class has a static member function and a static member variable. If the said member function is called in the threads concurrently, is it necessary that the calling of the static function be synchronized among the threads? Similarly, for the static member variable, if more than one thread read/write it, should the accesses of threads to the variable be synchronized? Thanks for your help! Big YES! Ali R. "stub" <stub@asof.com> wrote in message news:AjTpb.27164$Ec1.2488062@bgtnsc05-news.ops.wo...

INF for Ports class CDC USB device using usbser.sys fails DTM INFT
If a USB-to-serial CDC ACM specification device using usbser.sys is not classified as a modem, the New Hardware Wizard will not install the Virtual COM Port unless the INF file AddService directive Flags parameter has a value of 2 to set the SPSVCINST_ASSOCSERVICE bit. This causes both ChkInf and the DTM "INFTest for a single .INF" to fail with error "(E.22.1302) Filter drivers cannot be the controlling service (SPSVCINST_ASSOCSERVICE)." To certifiy the driver for a device that otherwise passes WINQUAL testing but is less complicated than a modem, is there any...

Exchange WMI Error
I've a WMI script using Exchange_Publicfolder object to update replica list and it is failing on one (out of two) of my Exchange 2003 EE SP2 servers with following error: Source: WinMgmt Description: Failed to CoGetClassObject for rovider "ExchangePublicFolderProvider". Class not registered (0x80040154). Script runs fine on another Exchange server. Does any one know cause of the problem or how to troubleshoot it? Thanks. ...

Weird question on filling in typing in excel
I have a question about fill in cells in excel kind of like a list or a combo box. I have someome that wants to be able to start typing in excel and have the rest of the characters popup like the url address does in IE. I don't think that this is possible in excel, but I could be wrong because I'm not that familiar with it. I would think that it would have to be backed up by a database for this to work. Could someone help me on this one. I would like to initially do it with out a DB behind it. I have ID#'s and Client names that I would like to popup into the cells after typi...

Problem typing single-spaced centered letterhead in Word 2007
Hi, Earlier I had a problem getting single-spaced typing because of the way Word 2007 is set up. I thought I had the problem licked when one of the MVP's recommended the following: What you need to do is click the Change Styles button (to the right of the Quick Styles in the Styles group) and select Fonts. The Gallery that opens when you choose Fonts is called Built-in. Office Classic is one of the selections. However, when I try to type a centered single-spaced heading, I get a double space after the first centered line, as in the following: Jane Doe 111 Main S...