g++ compilation error on gcc 4.4.6

GUPTA, GAURAV G (GAURAV) gaurav.g.gupta@alcatel-lucent.com
Mon Mar 18 13:02:00 GMT 2013


Hello There 

While trying to compile my c++ application with new gcc/g++ I am hitting the below error .
Where as I see the timeval is defined in time.h and I have included time.h 

/vob/ngn_src/include/CpsCmnTime.h:457: error: invalid use of incomplete type 'const struct timeval'
/vob/ngn_src/include/CpsCmnTime.h:160: error: forward declaration of 'const struct timeval'

My declaration is as below .

inline static bool setTime (struct timespec& pTimespec, struct timeval         const &pTimeVal);

inline  bool CpsCmnTime::setTime (struct timespec& pTimespec,
                     struct timeval const &pTimeVal)
{
  pTimespec.tv_sec = pTimeVal.tv_sec + (pTimeVal.tv_usec / 10000000);
   (pTimeVal.tv_usec % 1000000)
     ? pTimespec.tv_nsec = (pTimeVal.tv_usec % 1000000) * 1000
   : pTimespec.tv_nsec = 0;
  return true;
}

Thanks
Gaurav 



More information about the Gcc-help mailing list