Error -incompatible type not allowed using Visual Studio 2013 and .NET Framework ver 4.5 c++

Jay Prakash SIngh 1 Reputation point
2022-02-14T04:09:21.89+00:00

Problem Statement: Using Environment-Visual studio 2013 and .NET framework ver 4.5, I am getting line error -Incomplete type not allowed. Compiler error are defined below.
error 29 error C2079: uses undefined struct 'timespec'

My Code:
Header file using Time.h
C++ - Incomplete type not allowed while declaring struct of -below are example

typedef struct timespec sc_t;
int sec_timed_out(sc_t* timer,unsigned long delaySec)
{
sc_t now; <--Error observed here
sec_get_time_stamp(&now);

if(timer != NULL)
{
if((now.tv_sec >= timer->tv_sec) &&
((now.tv_sec - timer->tv_sec) >= delaySec)) {
return 1;
} else if(now.tv_sec < timer->tv_sec) { /* date or time change in past */
return 1;
}
}
return 0;
}

Additional Information: Above code works fine using Visual Studio 2017

Request: Please advise how to fix this compilation issue in VS 2013

Developer technologies .NET .NET CLI
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.