【发布时间】:2013-08-28 07:54:11
【问题描述】:
我正在使用 G3D,但无法访问 Random 类。
我是 C++ 新手,真的不知道在哪里可以作为参考。
随机类的参考在这里:http://graphics.cs.williams.edu/courses/cs371/f10/G3D/manual/class_g3_d_1_1_random.html
到目前为止,我已经在全球范围内定义了双打:
static double xPos, yPos, xVel, yVel;
以及随机库的包含:
#include <G3D/Random.h>
然后在我尝试使用的函数中:
xPos = (double)Random.integer(-10,10);
但我得到了错误:
Error: a nonstatic member reference must be relative to a specific object.
我不知道如何处理它。我看不出我的语法有什么问题,我查过的 C++ 快速参考指南说它是有效的。任何帮助表示赞赏。谢谢。
【问题讨论】: