Forums - timeval redefinition compilation error

1 post / 0 new
timeval redefinition compilation error
ivmai77
Join Date: 5 Sep 14
Posts: 1
Posted: Thu, 2017-06-08 12:09

Hello,

I get the following compilation error. test.c and the fix are below. Hexagon SDK version: 3.2.

In file included from test.c:3:
C:\Qualcomm\Hexagon_SDK\3.2\tools\HEXAGON_Tools\8.0.10\Tools\target\hexagon\include\sys/time.h:50:8: error: redefinition of 'timeval'
struct timeval {
       ^
C:\Qualcomm\Hexagon_SDK\3.2\libs\common\qurt\ADSPv62MPCPP\include\posix\common/time.h:22:8: note: previous definition is here
struct timeval
       ^
1 error generated.

test.c:

#include <pthread.h>
#include <sys/time.h>

time.diff (the fix):

--- Hexagon_SDK/3.2/libs/common/qurt/ADSPv62MPCPP/include/posix/common/time.h.orig    2017-06-04 21:37:16.143823700 +0300
+++ Hexagon_SDK/3.2/libs/common/qurt/ADSPv62MPCPP/include/posix/common/time.h    2017-06-08 19:45:40.688822200 +0300
@@ -19,11 +19,14 @@
 #define _PROVIDE_POSIX_TIME_DECLS 1
 #include <generic/time.h>
 
+#ifndef _STRUCT_TIMEVAL
+#define _STRUCT_TIMEVAL 1
 struct timeval
 {
     time_t tv_sec;   /* Seconds.     */
     long   tv_usec;  /* microseconds. */
 };
+#endif
 
 struct itimerspec
 {
--- Hexagon_SDK/3.2/tools/HEXAGON_Tools/8.0.10/Tools/target/hexagon/include/sys/time.h.orig    2017-06-04 21:37:07.889823700 +0300
+++ Hexagon_SDK/3.2/tools/HEXAGON_Tools/8.0.10/Tools/target/hexagon/include/sys/time.h    2017-06-08 19:46:01.995822200 +0300
@@ -47,10 +47,14 @@
  * and used in other calls.
  */
 _C_STD_BEGIN
+
+#ifndef _STRUCT_TIMEVAL
+#define _STRUCT_TIMEVAL 1
 struct timeval {
     long    tv_sec;        /* seconds */
     long    tv_usec;    /* and microseconds */
 };
+#endif
 
 _EXTERN_C    /* declarations */
 int sys_gettimeofday(struct timeval *_Restrict, void *_Restrict) _NO_THROW;
 

 

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.