SFML平台错误:缺少类型说明符-假定为int
sfml platformer error: missing type specifier - int assumed
嘿,我试图检查我的玩家类的边界框是否与我的地图贴图的边界框碰撞。然而,它提出了这个错误。我在我的map。h中有一个定义叫做playermap;在包含了我的玩家h.之后,我通过输入if mapplplayer .boundingbox.intersects(platformboundingbox)来检查它们是否相交,然后碰撞就发生了。看一看,如果有什么见解,我将不胜感激。
这是我的map类的一部分
if(mapVector[i][j] == 1)
{
sprite.SetImage(BlockImage);
sprite.SetPosition(j * BLOCKSIZE, i * BLOCKSIZE);
platformBoundingBox.Top = sprite.GetPosition().y - 5;
platformBoundingBox.Bottom = sprite.GetPosition().y;
platformBoundingBox.Left = sprite.GetPosition().x - 5;
platformBoundingBox.Right = sprite.GetPosition().x;
Window.Draw(sprite);
if(mapPlayer.boundingBox.Intersects(platformBoundingBox))
cout<<"collision occured";
}
这里是我的map.h文件
出现错误的地方Player mapPlayer;
问题出在你的
using namespace sf;
这将使您的变量Window
与sf::Window
类冲突。
任意使用,例如
this->Window.Draw(...);
或者(我建议)停止使用using
语句。在声明中只需要多写四个字符,而且它还会使您的代码更加清晰。
相关文章:
- 缺少类型说明符 - 假定为 int.注意 c++ 不支持 default-int
- 错误:C4430:缺少类型说明符-假定为int.注意:C++不支持default-int
- 缺少类型说明符 - int 假定 声明静态成员后出错
- 是无符号的int"简单类型说明符"
- 声明 Windows API 结构 (DCB) 的对象 - 错误 C4430:缺少类型说明符 - 假定为 int
- C++ printf 字段宽度说明符“.*”期望 int 不size_t
- CREATESTRUCT错误C4430:缺少类型说明符-假定为int.注意:C++不支持默认的int C:xdc
- 需要接受教育:声明"void encrypt(char*, int)"具有不同的异常说明符"
- 错误 1 错误 C4430:缺少类型说明符 - 假定为 int.注意:C++不支持默认整数
- 缺少类型说明符-假定为int错误
- 缺少类型说明符 - 假定为 int(类问题)
- 字符串无法识别?C4430:缺少类型说明符 - 假定为 int
- 模板类:错误 C4430:缺少类型说明符 - 假定为 int.注意:C++不支持默认整数
- 错误 C4430、C2146 - 缺少类型说明符 - 假定为 int.注意:C++不支持默认整数
- 预期的类型说明符,并且无法在初始化时转换“int*”
- srand(time(NULL)):错误 C4430:缺少类型说明符 - 假定为 int.注意:C++不支持默认整数
- 错误C4430:缺少类型说明符-假定为int
- 缺少类型说明符-int假定C4430错误
- VC++缺少类型说明符-假定为int.注意:C++不支持default-int
- visual C++缺少类型说明符-假定为int