Cypress技术论坛
直播中

杨平

8年用户 1747经验值
私信 关注
[问答]

使用PSoC Creator 3与PSoC4先锋套件的常数参数错误

我使用PSoC Creator 3与PSoC4先锋套件。
这句话:
A= ATAN2F(B,C);
其中A、B和C是浮动的,给我这个错误:
生成错误:未定义的“ATAN2F”引用
然而,同一个句子的常数参数:
A= ATAN2F(1.0,2.0);
编译没有问题。
当然,在我的主页的开头,我还包括了数学。
有什么线索吗?我绝望了。

以上来自于百度翻译


     以下为原文
   I am using PSoC Creator 3.0 with PSoC4 PIONEER KIT.
    this sentence:
    a=atan2f(b,c);
    where a, b and c are floats, gives me this error:
    Build error: undefined reference to `atan2f'
     
    However, the same sentence with constant parameters:
    a=atan2f(1.0,2.0);
    compiles without problems.
    Of course I have    #include   at the begining of my main.c
    Any clue please?? I'm desperate.

回帖(2)

杨平

2019-7-12 08:52:49
非常感谢你的帮助。
在附加图书馆领域里写“M”一次!!
你能解释一下你是如何得出这个结论的吗?
除了PSoC创建者的帮助之外,还有什么我应该阅读的文档吗?
我的印象是PSoC的模块数据表是很棒的,但是当涉及到标准C在特定系统中如何工作时,太多的事情被认为是理所当然的。

以上来自于百度翻译


     以下为原文
   Thank you very much, hli for your help. 
    Writting "m" in the additional libraries field worked at once!!
    Can you please explain how you arrived to that conclusion?
    Is there any documentation I should read apart from PSOC creator help?  
    I have the impression that  PSOC's modules datasheets are great, but when it comes to how standard c works in a particular system, too many things are taken for granted.
举报

姜钰

2019-7-12 09:04:48
这是基本的GCC知识。
ATAN2F是一个数学函数,它们不是普通库的一部分。在编译提示中得到的错误消息(“未定义引用”总是意味着函数缺失,而这通常是缺少的库)。
因为我碰巧知道“LBM”是数学库,它只需要知道在哪里添加它(并且‘LIB’部分不需要给出,所以它只是‘M’)。

以上来自于百度翻译


     以下为原文
  It's basic gcc knowledge.
    atan2f is a math function, and they are not part of the normal libraries. The error message you get during compile hints at that ('undefined reference' always means that function is missing, and this is usually a missing library).
    And since I happen to know that 'libm' is the math library, its just a matter of knowing where to add it (and that the 'lib' part doesn't need to be given, so its just 'm').
 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分