У меня странная ошибка, которая появляется в следующем коде:
#ifndef BALL_H_
#define BALL_H_
#include <list>
#include "SFML/Graphics.hpp"
using namespace sf;
class Ball : public CircleShape {
protected:
unsigned int mass; //the mass of the ball
float xSpeed; //the x component of the ball speed
float ySpeed; //the y component of the ball speed
public:
//Constructor : need the screen dimensions to center it
Ball(const unsigned int width, const unsigned int height);
//function that update the position of the ball and handle collisions.
void update(const unsigned int width, const unsigned int height, list<Ball>::iterator *it);
};
#endif /* BALL_H_ */
Ошибка: Symbol 'list' не может быть разрешен. Тем не менее, я использую библиотеку списков в другом файле в том же проекте, и он отлично работает.
Я использую eclipse и linux.
Единственное решение, которое я нашел до сих пор на форуме eclipse, заключалось в закрытии и повторном открытии проекта... не работало для меня.
Спасибо за любую помощь =)
Вы должны добавить std::
перед list<...>
. Я предполагаю, что где бы вы ни использовали его, у вас есть using namespace std
или что-то эквивалентное в верхней части файла.
void update(const unsigned int width, const unsigned int height, std::list<Ball>::iterator *it);
std::list
, вы забыли указать пространство имен.