[odb-users] Support for ODB on QNX

Boris Kolpackov boris at codesynthesis.com
Mon Aug 24 07:17:50 EDT 2020


Juan Pablo Samper <jp.samper at apex.ai> writes:

> When compiling a file generated by the odb compiler, I get the following
> errors:
> 
> analysis_result_odb.cpp:105:11: error: '::__time_t' has not been declared
> analysis_result_odb.cpp:114:7: error: '::__suseconds_t' has not been
> declared

When generating database support code on one platform to be used on
another you have to be careful not to depend on platform-specific
definitions (or hack things around to match). I am pretty sure the
above error is caused by your use of struct timeval.

One way to resolve this would be to map timeval to a value type that
has a platform-independent definition. Something along these lines
(the mapping might need some type casting to get rid of warnings):

#pragma db value
struct odb_timeval
{
  std::int64_t tv_sec;
  std::int64_t tv_usec;
};

#pragma db map type(timeval) as(odb_timeval)  \
    to(odb_timeval{(?).tv_sec, (?).tv_usec})  \
    from(timeval{(?).tv_sec, (?).tv_usec})



More information about the odb-users mailing list