c++ - 无法解析符号列表

标签 c++ linux eclipse symbols

<分区>

我在下面的代码中出现了一个奇怪的错误:

#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's speed
    float ySpeed;       //the y component of the ball's 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_ */

错误是:无法解析符号“列表”。但是,我在同一个项目的另一个文件中使用列表库,它工作得很好。

我正在使用 eclipse 和 linux。

到目前为止,我在 eclipse 论坛中找到的唯一解决方案是关闭并重新打开该项目...对我不起作用。

感谢您的帮助 =)

最佳答案

您必须添加 std::list<...> 前.我假设你在其他任何地方使用它你都有 using namespace std或文件顶部的等效内容。

void update(const unsigned int width, const unsigned int height, std::list<Ball>::iterator *it);

关于c++ - 无法解析符号列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27922872/

相关文章:

linux - Bash:无效的命令

c++ - Cmake 生成的 Eclipse 项目 - 无源

eclipse - Google Guice 3和OSGi(Eclipse春分)问题,

android - 无法添加airpush新SDK的横幅广告

c++ - 标准 C++ 线程 ID - 奇怪的行为

c++ - 当某些错误是可接受的时,顺序加载存储原子的内存顺序应该是什么

c++ - 为较大的数组分配对齐的内存

linux - 来自 bash 脚本的 source ~/.bashrc 不起作用

c++ - 如何处理柯南服务器连接被拒绝?

linux - 我明白/dev/urandom 了吗?