im试图编译一些c ++东西,并希望有一个包含SFML RenderWindow的类(具体来说,它是派生类)。但是,它不起作用,并且给了我一个编译器错误。
如果我将命令放在主方法中,它将按预期工作并打开具有指定大小的窗口。
#include <SFML/Graphics.hpp>
class CoordVisualizer : public GraphVisualizer {
public:
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
};
引发错误:
a_stern.cpp:15:43: error: expected ')' before numeric constant
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
^~~
a_stern.cpp:15:43: error: expected ')' before numeric constant
a_stern.cpp:15:42: error: expected ';' at end of member declaration
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
^
a_stern.cpp:15:43: error: expected unqualified-id before numeric constant
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");