-1

I'm working on SFML here and I want to create my own RenderWindow class with Legacy. But the g++ prints this error: expected class-name before ‘{’ token at line 7 in .hpp

I all ready ask Google about it but I didn't find what I was expecting at so I hope you will be able to help me to find this out :)

my_render_window.hpp

#ifndef MY_RENDER_WINDOW_HPP_
# define MY_RENDER_WINDOW_HPP_

# include <SFML/Window.hpp>

class MyRenderWindow : public sf::RenderWindow
{
public:
  MyRenderWindow();

protected:

};

#endif /* !MY_RENDER_WINDOW_HPP_ */

my_render_window.cpp

#include "my_render_window.hpp"

MyRenderWindow::MyRenderWindow(): sf::RenderWindow()
{

}

I compile correctly without these files and taking base sf::RenderWindow class to run with.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118

1 Answers1

0

Okay, I dont know why but with this include #include <SFML/Graphics.hpp> just after the #include <SFML/Window.hpp> it works !

So weird... :( #include <SFML/Graphics.hpp> may includes a file that I need to.

  • Looks like `Graphics.hpp` includes `Graphics/RenderWindow.hpp`, which corresponds to the listed general `RenderWindow.hpp` they have. I find that a little bit confusing, but ok. – chris Nov 21 '14 at 14:05
  • RenderWindow is part of SFML/Graphic not SFML/Window so my bad... :S I just find this reading the Window and Graphics header files... – Rodolphe Chartier Nov 21 '14 at 14:43