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

  • Home
  • SEARCH
  • 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 7746459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:17:00+00:00 2026-06-01T10:17:00+00:00

I am trying to make a simple program with SFML. So far I have

  • 0

I am trying to make a simple program with SFML. So far I have a main file and a file to open the window, and that file’s header. Thing is, I’ve had a problem with the header:

#ifndef Window.hpp
#define Window.hpp

Window();
int Loop();

#endif

I get this error:

C:…\Window.hpp|4|error: expected unqualified-id before ‘.’ token|

The window file is:

#import <SFML/Window.hpp>
#import <iostream>

// This file needs to create and maintain the program's window, and change it's state.

class Window
{
sf::RenderWindow appWindow;
sf::Image charImage;
sf::Sprite charSpriteSheet;

public:
Window();
int Loop();
}

Window::Window()
{
appWindow.Create(sf::VideoMode( 800, 600, 32), "AI_Fighter");
if( !charImage.LoadFromFile("Bass.png") )
{
    cout << "Problem opening file 'Bass.png'";
}

charSpriteSheet.SetImage(charImage);
}

int Window::Loop()
{
    // Start game loop
while (appWindow.IsOpened())
{
    sf::Event evt;
    while (appWindow.GetEvent(evt))
    {
        // Window closed
        if (evt.Type == sf::Event::Closed)
            appWindow.Close();

        // Escape key pressed
        if ((evt.Type == sf::Event::KeyPressed) && (evt.Key.Code == sf::Key::Escape))
            appWindow.Close();
    }

    // Get elapsed time
    float ElapsedTime = appWindow.GetFrameTime();

    // Move the sprite
    if (appWindow.GetInput().IsKeyDown(sf::Key::Left))  charSpriteSheet.Move(-100 * ElapsedTime, 0);
    if (appWindow.GetInput().IsKeyDown(sf::Key::Right)) charSpriteSheet.Move( 100 * ElapsedTime, 0);
    if (appWindow.GetInput().IsKeyDown(sf::Key::Up))    charSpriteSheet.Move(0, -100 * ElapsedTime);
    if (appWindow.GetInput().IsKeyDown(sf::Key::Down))  charSpriteSheet.Move(0,  100 * ElapsedTime);

    // Rotate the sprite
    if (appWindow.GetInput().IsKeyDown(sf::Key::Add))      charSpriteSheet.Rotate(-100 * ElapsedTime);
    if (appWindow.GetInput().IsKeyDown(sf::Key::Subtract)) charSpriteSheet.Rotate( 100 * ElapsedTime);

    // Clear the screen (fill it with black color)
    appWindow.Clear(sf::Color( 0, 0, 0));

    appWindow.Draw(charSpriteSheet);

    // Display window contents on screen
    appWindow.Display();
}
}
  • 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-06-01T10:17:01+00:00Added an answer on June 1, 2026 at 10:17 am

    Change your code from:

    #ifndef Window.hpp
    #define Window.hpp
    

    to

    #ifndef Window_hpp
    #define Window_hpp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a simple program that could open a new activity
I'm trying to make a simple program that continually displays and updates a label
i'm trying to make a simple Java program to open an existing word-document, change
I'm new to android and I'm trying to make a simple android program that
I am currently trying to make a very simple C program for school that
i am trying to make a very simple program that invert the pixels position
I'm trying to make a simple program that goes to a page and clicks
im trying to make a simple program that has one BITMAP that is the
I'm trying to make a simple program that shows that lets an image bob
I am trying to make a simple program that handles files and directories, but

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.