我的VSCode遇到了问题。
当我使用 MinGW 时,它向我显示identifier ... is Undefined
错误,这不会影响代码的执行,
但是当我切换到 Win32 时,所有这些错误都消失了。 即使我包含了所需的库,也会发生这种情况。我想知道是否有人可以帮助我解决问题,我该如何解决。
这是我的标题:
#include <iostream>
#include <vector>
#include <tuple>
#include <fstream>
#include <algorithm>
#include <windows.h>
#include <ctime>
例如,如果我写一个简单的代码,那么一些东西会像这样处理时间:
int main()
{
time_t now = time(0);
cout<<ctime(&now);
return 0;
}
只有当我使用 MinGW 时,它才会向我显示这样的错误
identifier "make_tuple" is undefined
identifier "get" is undefined
identifier "time" is undefined
identifier "localtime" is undefined
identifier "asctime" is undefined
identifier "ctime" is undefined
确保为这些函数使用std::
前缀。
代替make_tuple
,使用std::make_tuple
等。