Why do you include "Window.h" in "Window.h" this already must cause compilation error.
#ifndef WINDOW_H
#define WINDOW_H
#include <string>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
class Window
{
public:
Window();
Window(std::string& title, sf::Vector2u& windowSize);
~Window();
private:
std::string m_title;
sf::Vector2u m_windowSize;
sf::RenderWindow m_window;
bool m_fullScreen;
bool m_isDone;
void setup(const std::string& title, sf::Vector2u windowSize);
void create();
};
#include "Window.h" //<- why
Window::Window()
{
setup("My Window", sf::Vector2u(640, 480));
}
Window::Window(std::string & title, sf::Vector2u & windowSize)
{
setup(title, windowSize);
}
Window::~Window()
{
}
void Window::setup(const std::string & title, sf::Vector2u windowSize)
{
m_title = title;
m_windowSize = windowSize;
m_fullScreen = false;
m_isDone = false;
create();
}
void Window::create()
{
auto style = (m_fullScreen ? sf::Style::Fullscreen : sf::Style::Default);
m_window.create() //sf::RenderWindow has no member "create"
}
#endif // !WINDOW_H
Because as long as I see this, it makes me think, that function definitions and function declarations are in the same file.