2012-03-13 107 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

相關問題