error: no matching function for call to ‘sf::RenderWindow::draw(Map (&)())’ | c++

error: no matching function for call to ‘sf::RenderWindow::draw(Map (&)())’ | c++

我在 Linux 上使用 SFML,我正在尝试绘制一个 class 名称 Map 它有 public: sf::Drawable,但是当我尝试做window.draw(map) 我明白了

src/Main.cpp: In function ‘int main()’:
src/Main.cpp:30:18: error: no matching function for call to ‘sf::RenderWindow::draw(Map (&)())’
   30 |   window.draw(map);

也尝试制作绘图函数 public,并调用它,但仍然出现同样的错误。

Full Code

将地图定义为 Map map(); 修复将其定义为 Map map;