1

我正在尝试为我定义的类“FeralScene”创建指针对象

但我不断收到此错误“语法错误:缺少';' 前 '*'”

我不知道我的代码有什么问题... smone 可以帮助我吗?

/***********************************************************************
2D Engine Header File

File Name:  FeralFramework
File Desc:  Header to the Main Framework file

************************************************************************/
#ifndef FERALFRAMEWORK_H
#define FERALFRAMEWORK_H

#pragma once
#include<Windows.h>
#include<d3d9.h>
#include<d3dx9.h>
#include<string>
#include <dinput.h>

#include"FeralScene.h"

#include"GraphicDevice.h"
#include "Stdinc.h"


LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);

class FeralFramework
{
public:
    LPDIRECTINPUT8 inputDevice;
    LPDIRECT3DDEVICE9 Device;
    HWND WindowHandler;
    HINSTANCE Instance;
    FeralScene *CurrentScene,*PrevScene; // error occurs here

    GraphicDevice graphicDevice;

    static HWND StaticWindowHandle;
    static IDirect3DDevice9 *GraphDevice;

    int ScreenHeight;
    int ScreenWidth;
    bool IsFullScreen;

    bool WindowCreation();
    bool InitDirectx();

    void MessageLoop();
    void SetLighting();
    void UpdateDrawLoopCallFunction();
    void InitFrameWork();
    void Render();
    void initializeDirectInput();
    //void Camera(int mx, int my);

    void SceneSwitcher(FeralScene *SCENETOSWITCHTO);  
    // the FeralScene identifier error occurs here

    FeralFramework();
    FeralFramework(HINSTANCE Instance,int ScreenHeight,int ScreenWidth ,bool IsFullScreen,FeralScene *SentSceneObject );  
    // the FeralScene identifier error occurs here

    FeralFramework(HINSTANCE Instance,FeralScene *SentSceneObject);  
    // the FeralScene identifier error occurs here

};

inline LRESULT CALLBACK WndProc(HWND WindowHandler,UINT Msg,WPARAM wparam,LPARAM lparam)
{
    switch(Msg)
    {
    case WM_DESTROY:
        PostQuitMessage(0);
        return true;
    default:
        return DefWindowProc(WindowHandler,Msg,wparam,lparam);
    }

}

#endif

这是我尝试编译时弹出的错误列表

1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(33): error C2143: syntax error : missing ';' before '*'
1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(33): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(33): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(33): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(55): error C2061: syntax error : identifier 'FeralScene'
1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(58): error C2061: syntax error : identifier 'FeralScene'
1>c:\users\sys\documents\visual studio 2010\projects\feralengine\feralengine\feralframework.h(59): error C2061: syntax error : identifier 'FeralScene'

我错过了什么?任何帮助将不胜感激 :(

这是 FeralScene 的代码

/***********************************************************************
2D Engine Header File

File Name:  FeralScene
File Desc:  Header to the FeralScene file

************************************************************************/

#pragma once

#include<d3dx9.h>
#pragma once
#include<Windows.h>
#include<d3d9.h>
#include<d3dx9.h>
#include"GraphicDevice.h"
#include "FeralFramework.h"
//#include "Vector.h"

class FeralScene
{
public:
    HWND WindowHandler;
    IDirect3DDevice9 *Device;
    int BackBufferHeight;
    int BackBufferWidth;
    bool IsFullScreen,HasLoadedResources,HasUnloadedResources;

    virtual void Initialize(FeralScene *SentSceneObject) =0;
    virtual void Load(GraphicDevice graphicDevice) =0;
    virtual void Update(GraphicDevice graphicDevice) =0;
    virtual void Draw(GraphicDevice graphicDevice) =0;
    virtual void Unload() =0;
    virtual void Lighting()=0;
    virtual void LoadAnim()=0;
    virtual void UnloadAnim()=0;
};
4

1 回答 1

0

您将 FeralFrameWork.h 包含在 feralscene.h 中。哪个还不知道 FeralScene.h。您可以在 FeralFramework.h 中创建前向减速。我还建议在 FeralScene.h 中使用适当的宏来避免多次减速。

由于您在标头前向删除中使用指针类型将解决该问题。

   // this should be before the class FeralFramework
   class FeralScene;
于 2013-09-01T08:06:39.127 回答