Skip to content

Mini fix for addObject function #1

@ekinilseven

Description

@ekinilseven

Apologies ahead of time, first time commenting on Github.

When trying to run your code, I received the following error:

In file included from ./main.cpp:3:
./solver.hpp:66:56: error: member reference base type 'void' is not a structure or union
return m_objects.emplace_back(position, radius);

It was fixed when I redefined the addObject function in Solver class:

Original:
VerletObject& addObject(sf::Vector2f position, float radius)
{
return m_objects.emplace_back(position, radius);
}

Fix:
VerletObject& addObject(sf::Vector2f position, float radius)
{
m_objects.emplace_back(position, radius);
return m_objects.back();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions