iOS:sin()没有为架构i386找到符号

时间:2016-03-28 08:25:10

标签: c++ ios iphone xcode linker

我正在尝试在iPhone(模拟器)应用程序中使用math.h中的sin(),cos(),tan()。

我需要更改什么才能获得要链接的标准C数学库函数?

我正在使用.cpp文件进行调用。

e.g。

#include <math.h>
..
float f = tan( p1 );

链接器输出:

  "tan(float)", referenced from:

      GetTan(float) in myfuncs.o

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

我错过了一个必要的框架吗?

1 个答案:

答案 0 :(得分:2)

在某些环境中,您需要明确链接libm才能获得超越数学函数,因此请尝试将-lm添加到链接器标记中。