Error Redefinition Of Truct Timespec
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up resolving redefinition of timespec in time.h up vote 2 down vote favorite 2 I am writing a program which includes both /usr/include/linux/time.h and /usr/include/stdlib.h. The problem is: stdlib.h includes /usr/include/time.h, which defines 'struct timespec', and /usr/include/linux/time.h also defines one. This introduces a compilation error of redefinition. I've examined the definitions of 'struct timespec' in these two header files: in /usr/include/time.h: struct timespec { __time_t tv_sec; /* Seconds. */ long int tv_nsec; /* Nanoseconds. */ }; in /usr/include/linux/time.h: struct timespec { __kernel_time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; It seems that these definitions are indeed equivalent, but I can't prove it. My question is: is there a robust way to resolve this redefinition? Links to discussions on this problem are also highly appreciated. Thanks. c linux linux-kernel share|improve this question edited Dec 24 '13 at 12:20 Sport 2,69231737 asked Dec 24 '13 at 11:01 Hatrick 98210 2 I think you wrongly include both headers: /usr/include/linux/time.h seems to be for kernel modules. –Liviu Dec 24 '13 at 11:36 2 Why do you want to include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Timespec redefinition error [duplicate] up http://stackoverflow.com/questions/20759750/resolving-redefinition-of-timespec-in-time-h vote 2 down vote favorite 1 This question already has an answer here: Timespec :struct type Error c2011 3 answers While executing a Pthread program in C using Visual Studio 2015, I got the following error: Error C2011 'timespec': 'struct' type redefinition The following is my code: #include
Sign in Pricing Blog Support Search GitHub This repository Watch 5 Star 7 Fork 4 https://github.com/ghostlander/nsgminer/issues/1 ghostlander/nsgminer Code Issues 7 Pull requests 0 Projects 0 Pulse Graphs New issue Having difficulty building on windows with "redefinition of 'struct timespec #1 Open thnass opened this Issue Jan 2, 2016 · 1 comment Projects None yet Labels None yet Milestone No milestone Assignees No one error redefinition assigned 2 participants thnass commented Jan 2, 2016 make ended with 2 errors, using "-DHAVE_STRUCT_TIMESPEC" in the CFLAGS removes the first error but don't think it's the best and it seems i'm missing some corresponding header files somewhere. Can you please point out what i'm doing wrong and please help me error redefinition of fix them, thanks Make ended with 2 errors. " CC nsgminer-miner.o In file included from compat.h:32:0, from miner.c:57: c:\mingw\include\pthread.h:320:8: error: redefinition of 'struct timespec' struct timespec { ^ In file included from c:\mingw\include\unistd.h:95:0, from miner.c:29: c:\mingw\include\parts\time.h:65:8: note: originally defined here struct timespec ^ In file included from miner.c:57:0: compat.h:90:19: error: conflicting types for 'nanosleep' static inline int nanosleep(const struct timespec req, struct timespec *rem) ^ In file included from miner.c:29:0: c:\mingw\include\unistd.h:109:5: note: previous definition of 'nanosleep' was h re int nanosleep( const struct timespec *period, struct timespec *residual ) ^ In file included from miner.c:57:0: compat.h:122:19: error: conflicting types for 'sleep' static inline int sleep(unsigned int secs) ^ In file included from miner.c:29:0: c:\mingw\include\unistd.h:142:10: note: previous definition of 'sleep' was here unsigned sleep( unsigned period ){ return __mingw_sleep( period, 0 ); } ^ make[2]: ** [nsgminer-miner.o] Error 1" Owner ghostlander commented Jan 2, 2016 https://github.com/ghostlander/nsgminer/blob/7d37508484b7babc363df1534a67c0d8847eee10/compat.h#L89 MinGW64 defines nanosleep() and sleep(