Thread: Is there anything wrong with this class prototype

  1. #1
    Banned
    Join Date
    Jan 2003
    Posts
    1,708

    Is there anything wrong with this class prototype

    Is there anything syntactically wrong with this class prototype

    Code:
    #include "Controller.h"
    class	GameEntity	{
    public:
    virtual	 void	SendMessage();
    virtual	 void	GetMessage();
    	GameController_t	*Master;
    };
    I get these errors, and I honestly don't know why
    Compiling...
    Controller.cpp
    c:\program files\microsoft visual studio\vc98\include\shooters\bases.h(11) : error C2143: syntax error : missing ';' before '*'
    c:\program files\microsoft visual studio\vc98\include\shooters\bases.h(11) : error C2501: 'GameController_t' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\shooters\bases.h(11) : error C2501: 'Master' : missing storage-class or type specifiers
    Base Classes.cpp
    Skipping... (no relevant changes detected)
    BaseCode.cpp
    Shooters.cpp
    Error executing cl.exe.

    Shooters Class.exe - 3 error(s), 0 warning(s)

  2. #2
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>Is there anything syntactically wrong with this class prototype
    Yes, GameController_t doesn't seem to be a valid type. Did you double check your spelling? :-)
    *Cela*

  3. #3
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Yep, it's even highlighted blue with visual assist meaning it's a valid data type

    Controller.h

    Code:
    #ifndef EVENTS_MASTER_H
    #define EVENTS_MASTER_H
    
    class GameController_t {
    public:
    	Event	*GameEvents;		
    	bool	Active;	
    	void	Activate();
    	void	ProcessEvent(Event*);	
    	void	SendEvent();
    	bool	IsActive() {
    		return Active;
    	}
    	Model	m1;
    };
    #endif
    EDIT: I also created global gamecontroller t objects and executed member functions with success

  4. #4
    Slime Dragoon_42's Avatar
    Join Date
    Feb 2003
    Location
    Vancouver
    Posts
    90
    I could be wrong, but should GameController_t *Master;
    be private?

  5. #5
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    that's not what's causing the problem

    EDIT: and it would be protected because gameentity is an ADT
    EDIT1: Well I just plugged everything into the same header file and it seems to be working, I guess I'm an inbred (silly parents) because I must've spelled something wrong somewhere along the lines and not realized it, but I didn't break my keyboard yet!
    Last edited by Silvercord; 02-05-2003 at 08:32 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is wrong with this class?
    By BKurosawa in forum C++ Programming
    Replies: 3
    Last Post: 08-09-2007, 05:15 PM
  2. Replies: 8
    Last Post: 07-24-2006, 08:14 AM
  3. Replies: 8
    Last Post: 10-02-2005, 12:27 AM
  4. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM
  5. class member access denied
    By chiqui in forum C++ Programming
    Replies: 2
    Last Post: 05-27-2002, 02:02 PM