C++ 读取时间代码之前工作正常,现在出现错误

C++ 读取时间代码之前工作正常,现在出现错误,c++,string,time,ctime,C++,String,Time,Ctime,我正在为一项作业争取时间。我正在使用以下代码。它以前工作正常,但现在出现错误: #include <iostream> #include <string> #include <ctime> #include <vector> #include <sstream> using namespace std; #define LOG(x) cout << x << endl class Date { privat

我正在为一项作业争取时间。我正在使用以下代码。它以前工作正常,但现在出现错误:

#include <iostream>
#include <string>
#include <ctime>
#include <vector>
#include <sstream>

using namespace std;

#define LOG(x) cout << x << endl

class Date
{
private:
    string date;
    string time;
    string day;
    string month;
    string year;
    string WeekylQuote;

public:
    void TimeReadFromSystem(string &str) //this function read time of system
    {
        time_t my_time = time(NULL);
        
    }

    void StorerOfAscTimeIntoVariables(const string &str)
    {
        vector<string> strTok;
        istringstream ss(str);
        string deliminiters;
        while (ss >> deliminiters)
        {
            strTok.push_back(deliminiters);
        }
        //for (auto i : strTok)
        //cout << i << endl;
        //OUTPUT
        //Thu
        //Apr
        //22
        //00:46:59
        //2021

        // storing now day month year in respective variables
        date = (strTok[2]);
        month = (strTok[1]);
        year = (strTok[4]);
        time = (strTok[3]);
        day = (strTok[0]);
    }
};
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
#定义日志(x)列(删除器)
{
strTok.推回(Deliminers);
}
//用于(自动i:strTok)

//如果有一个名为
time
的成员变量,它将
time()
函数从全局范围隐藏起来。将其称为
std::time(NULL)或将变量重命名为其他变量。相关: