tags:

views:

358

answers:

1

Hi All,

I am trying to figure out whey I get an error: expected class-name before { token

Here is the relative source to the error:

#pragma once
#ifndef H_FXACTION
#define H_FXACTION

#include "CP_M_RefCounted.h"
#include "FxTypes.h"
#include "string"
#include "FxString.h"
#include "FxPixels.h"
#include "CP_Rect.h"
#include "FxStreamable.h"
#include "FxPoint.h"
#include "FxPtr.h"
#include "FxImage.h"
#include "FxSleekStreaming.h"

typedef FxID FxActionType;
typedef FxUInt32 FxActionID;

FxActionID FrMakeUniqueActionID(void); 

class FxActionData;

class FxActionData : public CP_M_RefCounted
{

    public:
    FxActionData();
    FxActionData(FxBool final) :mFinal(final) { }
    virtual ~FxActionData();

I get the error at this line: class FxActionData : public CP_M_RefCounted

What I dont get is why the line: class FxActionData; is there when you are creating the class directly under it. Isn't this a forward declaration?

What things could be going on here?

+3  A: 

class FxActionData; is a *forward declaration. It doesn't hurt anything but allows for not dragging in a full header file for, say, just a pointer to a class. It's useless in your case here.

The CP_M_RefCounted is probably a template (or might be declared in a namespace). Look into what's in CP_M_RefCounted.h

Nikolai N Fetissov
@Nikolai - Doh, it was a namespace issue
ML