本文介绍了iphone toRadians toDegrees编译器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  double oldLat = toRadians() oldLocation.coordinate.latitude); 

但我不断收到一个编译器警告和错误或隐含的toRadians和toDegrees声明



我包括 #import< math.h> 但是由于某种原因没有解决问题。

$

解决方案

基础类中没有toRadians 。您只需手动转换即可。



度* M_PI / 180.0



Foundation import math.h所以你会有M_PI,否则你必须



#include< math.h>


I am trying to convert a double to radians using the Objective c function toRadians like this:

double oldLat = toRadians(oldLocation.coordinate.latitude);

but I keep getting a compiler warning and error or implicit declaration of toRadians and toDegrees

I included #import <math.h> but that didn't solve the problem for some reason.

any help would be greatly appreciated.

解决方案

There is no toRadians in the Foundation classes. You can just convert it manually

degrees * M_PI / 180.0

Foundation imports math.h so you'll have M_PI otherwise you'll have to

#include <math.h>

这篇关于iphone toRadians toDegrees编译器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-11 08:54