gpt4 book ai didi

c++ - 无法解析函数 'sqrt' - Eclipse for Windows

转载 作者:行者123 更新时间:2023-11-27 22:54:20 25 4
gpt4 key购买 nike

这是我的第一个问题,我会尽量正确解释。

我正在使用 Windows 版 Eclipse,并安装了 MinGW 包,因此我可以轻松访问一些基本的包含项。事实上,我包含了 cmath 库,如下所示:

#include <cmath>

没有异常,Eclipse 没有给我任何错误或警告。但是有一行我使用了sqrt(),如下:

xone = (-b - sqrt(delta))/(2*a);

当然,我之前定义了xone、a、b、delta。但问题是 Eclipse 一直给我错误:

Description : Function 'sqrt' could not be resolved | Semantic Error

我研究了很长时间,但我能找到的所有答案都是关于检查是否包含 cmath,我确实这样做了。如果有人可以帮助我...谢谢!

最佳答案

<cmath>中的函数居住在 std命名空间。如果你需要使用它,你可以使用 std::sqrtusing std::sqrt; .

关于c++ - 无法解析函数 'sqrt' - Eclipse for Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34497136/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com