C++ 中的预期表达式,但我找不到错误

Expected Expression in C++, but I can't find the error

我最近买了一本叫做 "SFML Game Development by Example" 的书,代码给我带来了一些问题。

这是给我带来麻烦的行:

m_window.create({ m_windowSize.x, m_windowSize.y, 32 }, m_windowTitle, style);

方括号与大括号相接的地方({告诉我有一个预期的表达式。

这是整个文件的代码

#include "Window.h"

Window::Window(){
    Setup("Window", sf::Vector2u(640, 480));
}

Window::Window(const std::string& l_title, const sf::Vector2u& l_size){
    Setup(l_title, l_size);
}

Window::~Window(){
    Destroy();
}

void Window::Setup(const std::string& l_title, const sf::Vector2u& l_size){
    m_windowTitle = l_title;
    m_windowSize = l_size;
    m_isFullscreen = false;
    m_isDone = false;
    Create();
}

void Window::Create(){
    auto style = (m_isFullscreen ? sf::Style::Fullscreen : sf::Style::Default);
    m_window.create({ m_windowSize.x, m_windowSize.y, 32 }, m_windowTitle, style);
}

void Window::Destroy(){
    m_window.close();
}

void Window::Update(){
    sf::Event event;
    while(m_window.pollEvent(event)){
        if(event.type == sf::Event::Closed){
            m_isDone = true;
        }else if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::F5){
            ToggleFullscreen();
        }
    }
}

void Window::ToggleFullscreen(){
    m_isFullscreen = !m_isFullscreen;
    Destroy();
    Create();
}

void Window::BeginDraw(){
    m_window.clear(sf::Color::Black);
}

void Window::EndDraw(){
    m_window.display();
}

bool Window::IsDone(){
    return m_isDone;
}

bool Window::IsFullscreen(){
    return m_isFullscreen;
}

sf::Vector2u Window::GetWindowSize(){
    return m_windowSize;
}

void Window::Draw(sf::Drawable& l_drawable){
    m_window.draw(l_drawable);
}

我能想到的都做了。我什至从本书的网站下载了源代码,我检查了书籍的勘误表,看看是否应该进行更改。其他写这本书的人在这部分似乎没有问题,下载源代码仍然出现错误这一事实让我觉得这与我有关,但是呢?

您的代码需要支持您的编译器不支持的 C++ 11 功能。请参阅 VS2012 的 C++11 features 列表。如果要编译 C++11 代码,请升级到完全支持 C++11 的更新版本。