鑑於以下兩個頭文件:C++編譯器問題
#ifndef EVENT_HANDLER_H
#define EVENT_HANDLER_H
#include <SFML/Window.hpp>
#include <SFML/Window/Event.hpp>
#include "window_handler.h"
class EventHandler
{
public:
EventHandler(WindowHandler & classOwner);
WindowHandler * m_windowHandler;
private:
bool m_leftKeyDown;
bool m_rightKeyDown;
bool m_upKeyDown;
bool m_downKeyDown;
unsigned int m_mouseX;
unsigned int m_mouseY;
};
#endif
和
#ifndef WINDOW_HANDLER_H
#define WINDOW_HANDLER_H
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include "event_handler.h"
class WindowHandler
{
public:
WindowHandler();
sf::Window m_app;
private:
EventHandler m_eventHandler;
};
#endif
我得到以下輸出:
In file included from window_handler.h:6:0,
from main.cpp:3:
event_handler.h:13:29: error: expected ‘)’ before ‘&’ token
event_handler.h:15:2: error: ‘WindowHandler’ does not name a type
據我知道,不過,我一切都很好。我在這裏錯過了什麼嗎?
謝謝。所有獎勵積分! – zeboidlund