Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Regarding QNX 6.3.2 Header files: (1 Item)
   
Regarding QNX 6.3.2 Header files  
Hi,

I am new to QNX. I am trying to port an application on QNX 6.3.2. When I am trying to port I am facing with redefinition

 errors with system header files. For example,

In sys/time.h, we have a structure named timeval:

struct timeval {
        _CSTD time_t    tv_sec;         /* seconds */
    suseconds_t         tv_usec;        /* microseconds */
};

I have the same definition in my own application also like:

typedef struct timeval
{
    UINT4  tv_sec;   /* Time in Seconds */
    UINT4  tv_usec;  /* Time in Microseconds */
} timeval;

When I compile, I am facing with redefinition erros.
I am unable to suppress the inclusion of system header files when I compile from top level as other modules are also 
requiring it.

I cross-checked the definition of timeval structure in Linux Header file: /usr/include/bits/time.h

# ifndef _STRUCT_TIMEVAL
#  define _STRUCT_TIMEVAL       1
#  include <bits/types.h>

/* A time value that is accurate to the nearest
   microsecond but also has a range of years.  */
struct timeval
  {
    __time_t tv_sec;            /* Seconds.  */
    __suseconds_t tv_usec;      /* Microseconds.  */
  };
# endif /* struct timeval */
#endif  /* need timeval */

In Linux, they have a flag to check for the redefinition of structure.(_STRUCT_TIMEVAL ).But in QNX I am unable to find 

such a flag. Due to this,I am doing lots of patch work in my application.I am not sure how to avoid such kind of errors.

Please clarify me with a solution.Is there any better way to avoid it?