【发布时间】:2014-02-05 03:33:34
【问题描述】:
我正在编译一个在 Windows 7 上的 Visual Studio 2012 中使用 lround 的库。代码非常简单:
#include <iostream>
#include <math.h>
int main()
{
double dfoo = 42.546;
int ifoo = lround ( dfoo );
std::cout << dfoo << " => " << ifoo << std::endl;
return ( 0 );
}
我可以在 Linux 上使用 g++ 做到这一点。 MSDN 论坛说它应该编译。然而,Visual Studio 给我一个错误说lround 没有找到。确切的错误是:
1>------ Build started: Project: testnorm, Configuration: Debug Win32 ------
1> testnorm.cpp
1>c:\users\sanjiv\documents\visual studio 2012\projects\testnorm\testnorm\testnorm.cpp(7): error C3861: 'lround': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
有人能看出哪里出了问题吗?我是否缺少 Visual Studio 的一些编译器指令?
【问题讨论】: