and*_*and 2 c++ opengl visual-studio-2008
为什么我不能这样做?
#include <gl/gl.h>
GLfloat posX;
posX=0.0f;
Run Code Online (Sandbox Code Playgroud)
Visual Studio说:
错误C4430:缺少类型说明符 - 假定为int.注意:C++不支持default-int
Kei*_*ith 14
文本
posX=0.0f;
Run Code Online (Sandbox Code Playgroud)
在全球范围内,因此被视为声明,而不是声明.考虑:
#include "stdafx.h"
#include <windows.h>
#include <gl/gl.h>
GLfloat posY = 0.0f;
GLfloat posX;
posX = 0.0f;
GLfloat posZ;
int _tmain(int argc, _TCHAR* argv[])
{
posZ = 0.0f;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
然后posY,posZ编译正常,但posX显示问题.请注意,问题与GL无关; 如果用普通的旧浮子替换GLfloat,你会得到它.