I know, I know, this seems like an uber beginners question and most likely is. I have had this error several times and always figured it out myself, but this time it won't. GetUserData() returns a void*

#ifndef BLABLA_H
#define BLABLA_H
#include "GameEntity.h"

//class declaration left out for simplicity reasons

if (static_cast<GameEntity*>(point->shape1->GetUserData())->m_name == "player")

error C2061: syntax error : identifier 'GameEntity'
error C2143: syntax error : missing ';' before '{'

Error occurs because of the cast to GameEntity, don't see why though. This should be perfectly O.K
Any help is appreciated, I'm stuck at this for way too long already!

> //class declaration left out for simplicity reasons
You mean you just deleted where the problem is, and decided just to post where the problem shows up.

Try again.

Oh, and while we're at it, remove this ;

Sorry, I did not think that the class declaration could cause the problem. b2ContactListener is just a class from the Box2D library with all virtual functions which I overwrite.


#include "GameEntity.h"
#include <Windows.h>
#include <iostream>
#include <vector>

using std::cout;
using std::endl;

class CustomContactListener : public b2ContactListener
	std::vector<ContactPoint> m_points;

	virtual void Add(const b2ContactPoint* point)
              if (static_cast<GameEntity*>(point->shape1->GetUserData())->m_name == "player")


Alright, finally found the error. I used a namespace in some other file which caused a "syntax" error in the including class. Thx for the answer anyway. Anything that keeps me going is a help

Thanks for the update, can you now tick the "solved thread"?
This article has been dead for over six months. Start a new discussion instead.