【发布时间】:2012-06-18 15:00:45
【问题描述】:
我正在尝试使用 C++ 为 Mac 制作 SDL 游戏。我已经让所有与 SDL 相关的工作正常,但是当我尝试使用 sqrt 函数时,我收到错误 no matching function for call to 'sqrt'。这是我的包含列表和我的第一个函数(main() 函数现在并没有真正做任何事情):
#include <iostream>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <math.h>
#include "geometry.h"
using namespace std;
void drawLine(vector2 start, vector2 end)
{
double x = end.x - start.x;
double y = end.y - start.y;
double length = sqrt(x*x, y*y); // I get the error here
}
我也尝试过导入,结果相同。我需要在 Mac(Lion,XCode 4.3)上做些什么才能让它工作吗?
编辑:为了完整起见,geometry.h 包含 vector2 结构的定义
【问题讨论】:
标签: c++ macos xcode4 standard-library