2012-03-13 106 views
-1

(贴进口)为什么Xcode不能识别余弦?

#include <GLUT/glut.h>   //must be included for OpenGL 
#include <Opengl/gl.h>    //must be included for OpenGL 
#include <math.h> 

#include <time.h>   //must be included for time functions 
#include <iostream>   //must be included for console input/output 
#include <fstream> 


void ShowMapCircle2() 

float radius =300; 
float theta = 0; 

for(int i=0;i<12;i++) 
{ 
    glPushMatrix(); 
    glTranslated(radius*cos(theta), radius*sin(theta),0); 

    glTranslated(360,250,0); 
    glRotated(-90+i*30,0,0,1); 
    glTranslated(-360,-250,0); 

    glTranslated(360,250,0); 
    glScaled(0.4,0.4,1); 
    glTranslated(-360,-250,0); 

    ShowUSMAP(); 
    glPopMatrix(); 

    theta += 30*3.14159/180; 
} 

}

的Cos不被认可的Xcode。我不知道发生了什么事。我得到“使用未声明的标识符'cos'。”我确定这很简单,但我无法弄清楚。 'cos'似乎想在xcode中定义?

glTranslated(radius*cos(theta), radius*sin(theta),0); 
+0

张贴进口。 – Henry 2012-03-13 16:10:17

+0

构建。虽然不会显示。 – Henry 2012-03-13 16:19:40

回答

1

你记得包括数学头?

#include <math.h> 
+0

现在转动死亡沙滩球。 – Henry 2012-03-13 16:03:33

相关问题