What am i doing wrong?
I'd say everything...
First don't use global object and second a unique_ptr does
not equal a raw pointer, thus you
extern sf::RenderWindow* window; doesn't make
any sense.
For the actual compiler error the problem is obvious if you'd look at your code. Here I've colored your brackets:
window( new sf::RenderWindow( sf::VideoMode( (800,600,32), "Test") ) );A way better design would be to use a class:
Application.hpp#include <SFML/Graphics.hpp>
class Application
{
public:
Application();
void run();
private:
void update();
void draw();
private:
sf::RenderWindow m_window;
};
Application.cpp#include "Application.hpp"
Application::Application() :
m_window(sf::VideoMode(800, 600), "Test")
{
}
void Application::run()
{
while(m_window.isOpen()
{
update();
draw();
}
}
void Application::update()
{
sf::Event event;
while(m_window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
m_window.close();
}
}
void Application::draw()
{
m_window.clear();
m_window.display();
}
Main.cpp#include "Application.hpp"
int main()
{
Application app;
app.run();
}
AS you can see no need for any globals and everything is wrapped into a nice class.