SMFL "Cannot be Referenced, it is a deleted function"
SMFL "Cannot be Referenced, it is a deleted function"
我的DrawCircles(窗口)有问题;方法
当我试图通过"窗口"时,我的标题出现了错误。
知道我该怎么解决这个问题吗?另外,如果能解释一下,我们将不胜感激,谢谢。
这是我的代码:
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
vector<sf::CircleShape> Shapes;
int main() {
sf::RenderWindow window(sf::VideoMode(1280, 720), "Conduit");
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
DrawCircles(window); // ERROR IS THIS LINE.
//window.draw(shape);
window.display();
}
}
void RenderCircle()
{
sf::CircleShape shape;
shape.setRadius(40.f);
shape.setPosition(100.f, 100.f);
shape.setFillColor(sf::Color::Cyan);
Shapes.push_back(shape);
}
void DrawCircles(sf::RenderWindow window)
{
for (int i = 0; i < Shapes.size(); i++)
{
window.draw(Shapes.at(i));
}
}
请尝试在代码顶部添加DrawCircles方法的原型。并添加所有其他方法的原型。试试这个:
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
void DrawCircles(sf::RenderWindow &window);
vector<sf::CircleShape> Shapes;
.. rest of code
void DrawCircles(sf::RenderWindow &window)
{
for (int i = 0; i < Shapes.size(); i++)
{
window.draw(Shapes.at(i));
}
}
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- 库函数需要一个 std::function<void(void)>,如何传入类函数?
- Confusion: decltype vs std::function
- Why is UINT32_MAX + 1 = 0?
- 为什么 std::function 可以作为 std::not2 的参数?
- 'max'匹配'std::function<const int &(const int &, const int &)>'无过载
- C++错误:"error: int aaa::bbb is protected within this context"
- 传递给std::function template的template参数究竟代表什么
- 创建具有 new in 函数和"this is nullptr"异常的对象
- 将带有unique_ptr的可变 lambda 传递给 const&std::function
- "Called Object Type is Not a Function or Pointer" 与 typedef 和类
- "OpenCV Error: The function/feature is not implemented"安卓应用程序
- 虚假"<function> is expected to return a value"警告?
- "Called object 'int' is not a function or a function pointer"错误
- 为什么海湾合作委员会说"a function-definition is not allowed here before '{' token"?
- SMFL "Cannot be Referenced, it is a deleted function"
- "is not a member of"和"no matching function for call to"错误
- GCC - 删除"is used uninitialized in this function"警告
- 使用我自己的 plus() 函数时出现奇怪的 g++ 编译器错误 ( "std::plus is not a function" )