1

I'm having the most strangest error, I can't pushback an sf::text object into my sf::text vector. I can pushback floats, sf::sprite objects into my other vectors but my compiler just won't allow text objects to push

void Slime::setSlimeHealthTextVector()
{
    for (int i = 0; i < slimeVector.size(); i++)
    {
        sf::Text slimeHealth;
        slimeHealth.setFont(slimeFont);
        slimeHealth.setScale(0.1, 0.1);
        slimeHealth.setString("test");
        slimeHealthTextVector.push_back(slimeHealth);
    }
}

The error:

In file included from /usr/include/c++/8/vector:64,
                 from /usr/include/SFML/Window/VideoMode.hpp:32,
                 from /usr/include/SFML/Window.hpp:43,
                 from /usr/include/SFML/Graphics.hpp:32,
                 from Slime.h:1,
                 from Slime.cpp:1:
/usr/include/c++/8/bits/stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = sf::Text; _Alloc = std::allocator<sf::Text>]’:
/usr/include/c++/8/bits/stl_vector.h:1085:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<sf::Text*, std::vector<sf::Text> >’ changed in GCC 7.1
    _M_realloc_insert(end(), __x);
    ^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/vector:69,
                 from /usr/include/SFML/Window/VideoMode.hpp:32,
                 from /usr/include/SFML/Window.hpp:43,
                 from /usr/include/SFML/Graphics.hpp:32,
                 from Slime.h:1,
                 from Slime.cpp:1:
/usr/include/c++/8/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const sf::Text&}; _Tp = sf::Text; _Alloc = std::allocator<sf::Text>]’:
/usr/include/c++/8/bits/vector.tcc:413:7: note: parameter passing for argument of type ‘std::vector<sf::Text>::iterator’ {aka ‘__gnu_cxx::__normal_iterator<sf::Text*, std::vector<sf::Text> >’} changed in GCC 7.1
       vector<_Tp, _Alloc>::
       ^~~~~~~~~~~~~~~~~~~
mustafizr
  • 11
  • 1

0 Answers0