Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6390933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:36:35+00:00 2026-05-25T03:36:35+00:00

Given the following two header files: #ifndef EVENT_HANDLER_H #define EVENT_HANDLER_H #include <SFML/Window.hpp> #include <SFML/Window/Event.hpp>

  • 0

Given the following two header files:

#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

AND

#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

I get the following output:

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

As far as I know, though, I’m doing everything perfectly fine. Am I missing something here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:36:35+00:00Added an answer on May 25, 2026 at 3:36 am

    You have a circular dependency.

    When window_handler.h includes event_handler.h you’ve defined WINDOW_HANDLER_H but haven’t actually reached the point where the class is defined. When event_handler.h tries to include window_handler.h it doesn’t because of WINDOW_HANDLER_H

    As noted, you need to forward declare in event_handler.h by removing the include for window_handler.h and replacing it with:

    class WindowHandler;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following two ways of defining a class method in Ruby: class Foo
Given the following two classes: public class ABC { public void Accept(Ordering<User> xyz) {
Given the following two models: class Card(models.Model): disabled = models.BooleanField(default=False) class User(models.Model): owned_cards =
The problem is the following: given two bipartite directed graphs represented in .dot files,
Given the following two classes: class Location < ActiveRecord::Base belongs_to :holiday_schedule validates :name, :presence
Given the following two entities : class Parent { @OneToMany(cascade=CascadeType.ALL) private Set<Child> children; (...)
Is there a difference between the following two snippets for this given class? class
Problem Given the following two tables, I'd like to select all Ids for Posts
Given the following strings 7;#User One 7;#User Two;#9;#User Two 7;#User Two;#9;#User Two;#123;#User Three I
Given the following simple example: List<string> list = new List<string>() { One, Two, Three,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.