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

Copper Contributor

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

1 Reply

@jayprakashSingh 

Hello! You've posted your question in the Tech Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the .NET Runtime space - please post .NET Framework questions here in the future.