473,946 Members | 11,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error C2143: syntax error : missing ';' before '*'

4 New Member
Hi,

I'm doing a little game in OpenGL for college and I've got these 3 classes in C++:

WarBalls - represents the Game's Application. It is supposed to be a singleton and holds all the Game's Managers.
Expand|Select|Wrap|Line Numbers
  1. #ifndef WARBALLS_H
  2. #define WARBALLS_H
  3.  
  4. #include "cg/cg.h"
  5.  
  6. #include "ControllerManager.h"
  7. #include "CameraManager.h"
  8. #include "GameManager.h"
  9. #include "Light.h"
  10.  
  11. #include "NxPhysics.h"
  12. #include "ErrorStream.h"
  13.  
  14. namespace wbproject
  15. {
  16.     class WarBalls : public cg::Application    
  17.     {
  18.     private:
  19.         static WarBalls* instance;
  20.     protected:        
  21.         NxPhysicsSDK* _gPhysicsSDK;
  22.     public:        
  23.         WarBalls();
  24.         ~WarBalls();
  25.         static WarBalls* getInstance();
  26.         void createEntities();        
  27.         CameraManager* getCameraManager();
  28.         NxPhysicsSDK* getPhysics();
  29.     };
  30. }
  31.  
  32. #endif
  33.  
CameraManager - Manages which Camera to render.
Expand|Select|Wrap|Line Numbers
  1. #ifndef CAMMANAGER_H
  2. #define CAMMANAGER_H
  3.  
  4. #include "cg/cg.h"
  5. #include "FreeCam.h"
  6. #include "PanoCam.h"
  7. #include "FollowCam.h"
  8. #include "GameManager.h"
  9.  
  10. namespace wbproject{
  11.     class CameraManager :  public cg::Group,
  12.         public cg::GroupDraw,
  13.         public cg::GroupUpdate,
  14.         public cg::GroupReshapeEvent,
  15.         public cg::GroupMouseEvent
  16.     {    
  17.     protected:
  18.         void createEntities();
  19.         void postInit();
  20.     public:
  21.         CameraManager(std::string id);
  22.         ~CameraManager();        
  23.         void switchCamera(int activeCam);
  24.     };
  25. }
  26.  
  27. #endif
  28.  
  29.  
GameManager - Was created to manage the game's rules and state (and possibly, to command a future SceneManager)
Expand|Select|Wrap|Line Numbers
  1. #ifndef GAMEMANAGER_H
  2. #define GAMEMANAGER_H
  3.  
  4. #include "cg/cg.h"
  5. #include "Ball.h"
  6. #include "Box.h"
  7. #include "Force.h"
  8. #include "Level.h"
  9. #include "Wall.h"
  10.  
  11. #include "NxPhysics.h"
  12.  
  13. namespace wbproject{    
  14.     class GameManager : public cg::Group,
  15.         public cg::GroupDraw,
  16.         public cg::GroupUpdate
  17.     {
  18.     protected:
  19.         void createEntities();
  20.         void postInit();
  21.     public:
  22.         GameManager(std::string id);
  23.         ~GameManager();
  24.     };
  25. }
  26. #endif
  27.  
Also:
- I'm using VS 2008's VC++;
- the OpenGL libraries, GLU and GLUT are wrapped by a library provided by the teachers (that's the cg/cg.h);
- And the include of the "NXPhysics. h" is for the Nvidia's PhysX engine, but there is nothing implemented to use it yet;

Now, here is my problem:

I'm getting this error: "...\warballs.h (27) : error C2143: syntax error : missing ';' before '*'"

Everything was fine, until I had to "use" the GameManager inside the CameraManager class.
If i remove the "#include "GameManager.h" " from the CameraManager.h , the errors I get are those for not having the include (like "'GameManag er' : undeclared identifier").

I tried to not "replicate" the "#include "GameManager.h" " removing it from the WarBalls.h (since I have the "ifndef's", should do just the same, right?), but nothing changed....

I found another post about the same error in which someone said to check the ";" after the end of the classes definition (double checked it, but no luck...)

This is the first time I'm working in C++ (I'm more used to Java), and this seems like something very simple, but that I'm not aware of in the including inner process of C/C++...



Thanks in advance.
Oct 30 '08 #1
6 5877
gpraghuram
1,275 Recognized Expert Top Contributor
I thik a ; is missing in the GameMnager.h before the endif(End of the namespace } )


Raghu
Oct 31 '08 #2
zmee
4 New Member
I thik a ; is missing in the GameMnager.h before the endif(End of the namespace } )


Raghu
Thanks for your reply!

But, what you're saying would look anything like this? I tried it and the compiler continues to send the same error.
Expand|Select|Wrap|Line Numbers
  1. #ifndef GAMEMANAGER_H
  2. #define GAMEMANAGER_H
  3.  
  4. #include "cg/cg.h"
  5. #include "Ball.h"
  6. #include "Box.h"
  7. #include "Force.h"
  8. #include "Level.h"
  9. #include "Wall.h"
  10.  
  11. #include "NxPhysics.h"
  12.  
  13. namespace wbproject{    
  14.     class GameManager : public cg::Group,
  15.         public cg::GroupDraw,
  16.         public cg::GroupUpdate
  17.     {
  18.     (...)
  19.     };
  20. };
  21.  
  22. #endif
  23.  
Oct 31 '08 #3
newb16
687 Contributor
What if you declare the same function outside the class? Outside the namespace ( with namespace:: qualifier )? In the same header file where the GamaManager is defined?
Oct 31 '08 #4
zmee
4 New Member
What if you declare the same function outside the class? Outside the namespace ( with namespace:: qualifier )? In the same header file where the GamaManager is defined?
I think I can't, the function where I call the GameManager is the Manager's init event handler.

Expand|Select|Wrap|Line Numbers
  1.     void CameraManager::init(){        
  2.         ((FreeCam *)this->get("FreeCam"))->enable();
  3.         ((PanoCam *)this->get("PanoCam"))->disable();
  4.         ((FollowCam *)this->get("FollowCam"))->disable();
  5.  
  6.         GameManager* gm = ((GameManager *)cg::Registry::instance()->get("GameManager"));
  7.         Ball * b = (Ball *)gm->get("Ball");        
  8.         ((FollowCam *)this->get("FollowCam"))->followObject(b);
  9.  
  10.     }
  11.  
Oct 31 '08 #5
newb16
687 Contributor
I think I can't, the function where I call the GameManager is the Manager's init event handler.
I said 'declare' - to check if compiler issue an error on the same function ( with the same or other name ) declared in other place.
Oct 31 '08 #6
zmee
4 New Member
I said 'declare' - to check if compiler issue an error on the same function ( with the same or other name ) declared in other place.
I'm sorry, I didn't get it the first time.

I created another class

Expand|Select|Wrap|Line Numbers
  1. #ifndef TEST_H
  2. #define TEST_H
  3.  
  4. #include "cg/cg.h"
  5.  
  6. #include "CameraManager.h"
  7.  
  8. namespace wbproject2{    
  9.     class Test: public cg::Group,
  10.         public cg::GroupDraw,
  11.         public cg::GroupUpdate
  12.     {
  13.     protected:
  14.         void createEntities();
  15.         void postInit();
  16.     public:
  17.         Test(std::string id);
  18.         ~Test();
  19.         CameraManager* getCameraManager();
  20.     };
  21. }
  22.  
  23. #endif
  24.  
Commented the code in the WarBalls (in the cpp and h), but I'm getting the same error in this one.
Oct 31 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5544
by: Balaji | last post by:
I'm trying to do some basic socket programming. here is the line of code which is creating problem.. int FAR PASCAL __declspec (dllexport)(char * addr,int port) Hers is the error I'm getting.. error C2059: syntax error : '('
2
10936
by: kalpana.sinduria | last post by:
Hi all, how to remove the following complle error. When I compiling the code I get the following errors: Compiling... CDrtEachDefFeat.cpp d:\ include\common\cdrtintegfeat.h(39) : error C2143: syntax error : missing ';' before '*'
1
10898
by: kalyan. | last post by:
how do i overcome this problem ?? Thanku in Advance .
0
1957
by: MWK | last post by:
Hi All, I don't understand why I get "error c2061: syntax error : identifier" in VS2003. I thought it's fixed in .Net 2003: __hook(&TCP_Client::LineReceived, client, HandlerLineReceived); System::Void HandlerLineReceived(TCP_Client* sender, String* Data)
1
4166
by: IceColdFire | last post by:
I have a VC++.net Win32 console application, however when I compile , I get this error error C2146: syntax error : missing ';' before identifier 'Length' Explain... Location pointed is typedef struct _LIST
1
4381
by: parveen.beniwal | last post by:
hi all i am having the following line of code in my mak file. !IF "$(CFG)" == "" CFG=DesktopCommon - Win32 Release !MESSAGE No configuration specified. Defaulting to DesktopCommon - Win32 Release.
6
2991
by: Pixel.to.life | last post by:
So I have this perfectly fine and running app, that uses managed C++ forms. Problem#1: I pass a Bitmap reference to a class, hoping to modify it in one of the class's methods, so it reflects outside too. Something like this:
6
38113
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
4
11701
by: srinathvs | last post by:
Hi, I have an access db that I am trying to query from a vb6 program. I've the following code: Dim sSQLQuery As String sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID & Chr(39) ID here is equal to 1234567890 MsgBox sSQLQuery the msgbox says: SELECT * FROM TblData WHERE ID = '1234567890 Note that the quotation is missing at the end Set rs = db.OpenRecordset(sSQLQuery, dbOpenDynaset)
2
3980
shashahayes
by: shashahayes | last post by:
I am getting an error on this line, does anyone have any suggestions? here is the error here is line 25 if area > 750 then charge = 200 1>Furniture.cpp
0
10150
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9975
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11142
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6097
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4928
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.