为什么Xcode没有认可Cosine?

时间:2012-03-13 14:18:20

标签: xcode cosine

(已发布的进口商品)

#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;
}

}

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

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

1 个答案:

答案 0 :(得分:1)

你还记得包含数学标题吗?

#include <math.h>