【发布时间】:2018-03-30 14:29:28
【问题描述】:
#include <iostream>
#include <string>
#include <sstream>
//#include <bits/stdc++.h>
#include <iomanip> // std::setprecision
#include <math.h>
using namespace std;
我想删除标题#include <bits/stdc++.h>,因为它显着减慢了我的编译时间。
当我删除它时,我收到以下错误:
error: cannot convert ‘long double*’ to ‘double*’ for argument ‘2’ to ‘double modf(double, double*)’
fractpart = modf(val, &intpart);
我认为问题在于缺少头文件,但不知道是哪一个。
我收到错误的代码是:
fractpart = modf(val, &intpart);
if (fractpart != 0) {
throw Error("ERR");
}
【问题讨论】:
-
您的错误与包含的头文件没有任何关系。
intpart?是什么类型 -
您需要区分编译时和运行时,但无论哪种情况,您都不应该包含该标头 - 这是一个可能随时更改或删除的实施功能。
-
更多不去
#include <bits/stdc++.h>的理由:stackoverflow.com/questions/31816095/…
标签: c++ type-conversion include header-files