尽管名称空间正确,但缺少类型说明符

时间:2016-02-14 21:02:43

标签: c++ types namespaces directx specifier

我收到错误我通常会看到忘记将std::添加到string这样的对象上。在这种情况下,我自己的namespace名为x。具体错误如下:

Error 59 error C2143: syntax error : missing ';' before '*' e:\cppworkspace\xengine\xengine\code\include\x\graphics\graphics.h 32 1 XEngine

Error 60 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\cppworkspace\xengine\xengine\code\include\x\graphics\graphics.h 32 1 XEngine

图形头文件:

#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "x/x.h"
#include "x/graphics/d3dwrapper.h"

namespace x
{
    class Graphics
    {
    public:
        Graphics() {}
        ~Graphics(){}

        bool Init(int32 width, int32 height, bool fullscreen, HWND hwnd);
        void Destroy();
        void Update();
        void Render();
    protected:
    private:
        Graphics(const Graphics& other) {}

        D3DWrapper* m_d3d; // ERROR IS HERE
    };
}
#endif // GRAPHICS_H

D3DWrapper头文件:

#ifndef D3DWRAPPER_H
#define D3DWRAPPER_H

#include "x/x.h"
#include "x/system/system.h"

namespace x
{
    class D3DWrapper
    {
    public:
        D3DWrapper();
        ~D3DWrapper() {}

        bool Init(int32 width, int32 height, bool fullscreen, HWND hwnd);
        void Release();
        bool InitScene();

        void BeginScene(Color color);
        void EndScene();

        inline ID3D11Device* GetDevice() { return m_device; }
        inline ID3D11DeviceContext* GetDeviceContext() { return m_deviceContext; }

    protected:
    private:
        D3DWrapper(const D3DWrapper& other) {}

        ID3D11Device* m_device;
        ID3D11DeviceContext* m_deviceContext;
        IDXGISwapChain* m_swapChain;
        ID3D11RenderTargetView* m_renderTargetView;
    };
}


#endif // D3DWRAPPER_H

我似乎无法弄清楚我的代码可能出现什么问题以获取此错误,因此感谢任何帮助。

0 个答案:

没有答案