找不到c++时间戳标识符

c++ time stamp identifier not found

本文关键字:标识符 时间戳 c++ 找不到      更新时间:2023-10-16

我试图获得一个时间戳来显示系统提供的日期和时间。我得到'时间,'asctime'和'localtime'的错误-未找到标识符。我认为这应该是一个容易的解决方案,但我是一个新手程序员和超越卡住。谢谢!

#include <iostream>
using namespace std;

    int main()
    {
        cout << "Content-type: text/htmlnn";
        cout << "<center><h1>TEST</h1>n";

        return 0;
        time_t tTime = time(NULL);
    printf("Today is : %sn", asctime(localtime(&tTime)));
    }

您忘记添加#include <time.h>了吗?