Thread: type redefinition?

  1. #1
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455

    type redefinition?

    I haven't working on this program in forever, and I compiled it a week ago without any problems.

    I opened it today, no changes have been made, and it's giving these errors:

    c:\Documents and Settings\Administrator.NABEEL\My Documents\Visual Studio Projects\C++\RELEASE\L!quidBot\AIDLL\cAIBrain.h(15 ): error C2011: 'cAIBrain' : 'class' type redefinition
    c:\Documents and Settings\Administrator.NABEEL\My Documents\Visual Studio Projects\C++\RELEASE\L!quidBot\AIDLL\cAIBrain.h(6) : error C2011: 'BLOCK' : 'struct' type redefinition
    The code is:

    Code:
    struct BLOCK {
    	vector <string> say;
    	vector <string> resp;
    	bool nopunc;
    	int index;
    	BLOCK *next;
    };
    
    
    class cAIBrain {
    ...
    };

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Add this to your header:
    Code:
    #ifndef HEADER_3D252C71_01B7_49a5_BDF8_A34EB1F241F4
    #define HEADER_3D252C71_01B7_49a5_BDF8_A34EB1F241F4
    
    <your header here>
    
    #endif
    Replace the GUID with your own*, generated by guidgen.

    *) Or use a normal name. But using a GUID ensures 100% code compability.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    ah alright, ill see if that works

    nope still didn't work, no compile, same errors

  4. #4
    Have you tried pressing the execute button, alot of times when I try to compile and build it will give me errors saying that the implementation has changed when I've added something. Pressing the execute will bring up the BUILD new that seems to reload the files in VC++ and all seems well, seems like a VC++ thing or M$ thing cuase something similar happens in MSFrontPage.
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

  5. #5
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    ok i told it to clean build, and i compiled fresh.
    i get this error now, i have no clue what it means

    i havent added/subtracted any header files, and they're all defined in "stdafx.h"

    c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\atlctl.h(3284): error C2504: 'IObjectSafety' : base class undefined
    Code:
    #pragma once
    
    #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
    #include <stdio.h>
    #include <tchar.h>
    #include <stdlib.h>
    #include <windows.h>
    #include <string.h>
    #include <iostream>
    #include <vector>
    
    using namespace std;
    
    #include "..\AIDLL\cAIBrain.h"
    #include "..\AIDLL\misc.h"

    I'm not using MFC or ATL though..

  6. #6
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Does this help clarify your error some?

    The specified base class was declared but never defined.

    This error can be caused by a missing include file or an external base class that was not declared with the extern specifier.

    The following is an example of this error:

    class A; // error, A is undefined
    class A {}; // OK, A is defined
    class B : public A {}; // the error is detected here
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  7. #7
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    I'm getting error in a header file for an ATL class that I don't use..I don't have ATL enabled in my project

  8. #8
    I don't know, but structs annoy me.. try this. Even though it seems like it's not the answer to the current error, it may help.
    Code:
    typedef struct BLOCK {
    	vector <string> say;
    	vector <string> resp;
    	bool nopunc;
    	int index;
    	struct BLOCK *next;
    };
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  3. typename madness
    By zxcv in forum C++ Programming
    Replies: 4
    Last Post: 05-13-2006, 10:35 PM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM