Visual Studio 2019: Identifier "time_t" undefined

Caffeinated Pizza 1 Reputation point

Very simple header file:

#ifndef _PTIME_H
#define _PTIME_H
#pragma once

#include <ctime>

class PTime

 time_t now;


Is giving me an error Identifier "time_t" is undefined. How is this possible? I included the proper header file. Why is Visual Studio 2019 complaining about time_t?

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,601 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Guido Franzke 2,196 Reputation points

    try to include <time.h> .
    Regards, Guido

    1 person found this answer helpful.

  2. WayneAKing 4,921 Reputation points

    Are you getting a compile error, or an Intellisense error?

    If the latter, try using the option to rescan the solution
    found under the Project menu.

    Sometimes when code is added bit by bit Intellisense does
    not pick up all of the changes automatically. Doing a Rescan
    forces it to process all of the code in its current state.

    • Wayne
    1 person found this answer helpful.