错误 C3861:"roundf":找不到标识符
error C3861: 'roundf': identifier not found
我通常擅长谷歌搜索这样的东西,但这次我似乎找不到任何东西。
我从这里下载了一些源代码,它使用一个名为 roundf
的函数。
我已经有#include <math.h>
,作为第一个想法添加了#include <cmath>
但仍然有问题。我似乎找不到函数的来源...
有替代功能吗?或者有谁知道它来自哪里,以便我可以包含头文件?
roundf()
函数由 C99 定义,但 MSVC 实现的 C99 很少,因此它不适用于Microsoft编译器。
您可以使用这个:
float roundf(float x)
{
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
}
您还可以使用提升库:
#include <boost/math/special_functions/round.hpp>
const double a = boost::math::round(3.45); // = 3.0
const int b = boost::math::iround(3.45); // = 3
相关文章:
- 设置 Visual Studio for MPI: 找不到标识符错误
- 找不到标识符合并
- 在 c++ 中找不到此函数的标识符
- 从子类访问模板类成员时出现"找不到标识符"错误
- std::p opcount 标识符在 MSVC 16.6.0 中找不到
- OpenCV 3 错误"CV_FOURCC":找不到标识符
- C++ ATL | 找不到_InternalQueryInterface标识符
- im调用函数时找不到标识符?
- clock_gettime:在 Windows 10 的 Visual Studio 中找不到标识符
- 英特尔 TBB - "初始化关键部分 Ex":找不到标识符编译器错误
- 找不到标识符.C3861
- 找不到睡眠标识符 Visual Studio 2017
- 在void tryagain()上找不到标识符
- 找不到内存集标识符
- 在C 类中找不到标识符
- 找不到标识符,尝试在 C++ 中显示数组值
- 找不到QT 5.6 update()函数标识符
- 我遇到:错误2错误C3861:"fx":找不到标识符
- 找不到加载着色器标识符
- OpenGL - 'glTexSubImage3D':找不到标识符