Home > error redefinition > error redefinition of truct timespec

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 ??? –alk Dec 24 '13 at 15:58 @Liviu thank you for your attention. My program is trying to multiplex among disk and network io's with cooperative prioriy by utilizing Linux native AIO. Sometime later when it is stable, I will release it on github. I seems that to use the AIO interface, the header file is unavoidable. How do you think? –Hatrick Jan 20 '14 at 3:10 @alk thank you for your attention. Please see my comment above. Am I right? –Hatrick Jan 20 '14 at 3:11 @Hatrick Not

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, http://stackoverflow.com/questions/20759750/resolving-redefinition-of-timespec-in-time-h just like you, helping each other. Join them; it only takes a minute: Sign up Timespec redefinition error [duplicate] up 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: http://stackoverflow.com/questions/33557506/timespec-redefinition-error Error C2011 'timespec': 'struct' type redefinition The following is my code: #include #include #include void *calculator(void *parameter); int main(/*int *argc,char *argv[]*/) { pthread_t thread_obj; pthread_attr_t thread_attr; char *First_string = "abc"/*argv[1]*/; pthread_attr_init(&thread_attr); pthread_create(&thread_obj,&thread_attr,calculator,First_string); } void *calculator(void *parameter) { int x=atoi((char*)parameter); printf("x=%d", x); } The pthread.h header file contains the following code related to timespec: #if !defined(HAVE_STRUCT_TIMESPEC) #define HAVE_STRUCT_TIMESPEC #if !defined(_TIMESPEC_DEFINED) #define _TIMESPEC_DEFINED struct timespec { time_t tv_sec; long tv_nsec; }; #endif /* _TIMESPEC_DEFINED */ #endif /* HAVE_STRUCT_TIMESPEC */ No other header file which I use uses the timespec struct, so there is no chance of redefining. There is no chance of a corrupted header file because it has been downloaded from pthread opensource website. c windows visual-studio pthreads timespec share|improve this question edited May 6 at 12:08 vaxquis 5,79652541 asked Nov 6 '15 at 0:39 Vijay Manohar 5618 marked as duplicate by Rad Lexus, NobodyNada, rene, Mogsdad, Dan Getz May 6 at 20:04 This question has been asked before and already has an answer. If those answers

Sign in Pricing Blog Support Search GitHub This repository Watch 5 Star 7 Fork 4 ghostlander/nsgminer Code Issues 7 Pull requests 0 Projects 0 Pulse https://github.com/ghostlander/nsgminer/issues/1 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 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32474 yet Milestone No milestone Assignees No one assigned 2 participants thnass commented Jan 2, 2016 make ended with 2 errors, using "-DHAVE_STRUCT_TIMESPEC" in the CFLAGS removes the first error redefinition 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 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 error redefinition of 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(), MinGW32 doesn't usually. If your version comes with these, replace MINGW64 with MINGW32 until a universal solution comes up. Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You sig

Login: [x] User account creation filtered due to spam. Bug32474 - struct timeval collision in include files for MinGW cross compile Summary: struct timeval collision in include files for MinGW cross compile Status: RESOLVED INVALID Alias: None Product: gcc Classification: Unclassified Component: bootstrap (show other bugs) Version: 4.1.2 Importance: P3 normal Target Milestone: --- Assignee: Not yet assigned to anyone URL: Keywords: Depends on: Blocks: Reported: 2007-06-23 19:09 UTC by Rob Modified: 2007-06-23 21:04 UTC (History) CC List: 1 user (show) gcc-bugs See Also: Host: i686-pc-linux-gnu Target: i686-pc-mingw32 Build: i686-pc-linux-gnu Known to work: Known to fail: Last reconfirmed: Attachments Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Rob 2007-06-23 19:09:41 UTC When building for target i686-pc-mingw32 on host (Debian) i686-pc-linux-gnu I find the file /opt/build/gcc-4.1.2/libiberty/pex-win32.c uses both #include "pex-common.h" and "#include " thus we get this: In file included from /opt/mingw32/i686-pc-mingw32/sys-include/bits/resource.h:151, from /opt/mingw32/i686-pc-mingw32/sys-include/sys/resource.h:26, from /opt/mingw32/i686-pc-mingw32/sys-include/sys/wait.h:32, from /opt/build/gcc-4.1.2/libiberty/pex-win32.c:37: /opt/mingw32/i686-pc-mingw32/sys-include/bits/time.h:70: error: redefinition of 'struct timeval' Creating an ".i" file I see this: # 181 "/opt/build/gcc-4.1.2/libiberty/../include/libiberty.h" /* Get the current time. */ /* Prototypes vary from system to system, so we only provide a prototype on systems where we know that we need it. */ #ifdef __MINGW32__ /* Forward declaration to avoid #include . */ struct timeval; extern int gettimeofday (struct timeval *, void *); #endif # 109 "/opt/mingw32/i686-pc-mingw32/include/winsock2.h" 3 struct timeval { long tv_sec; long tv_usec; }; # 69 "/opt/mingw32/i686-pc-mingw32/sys-include/bits/time.h" struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; The file "sys/resource.h" includes "bits/resource.h", which then includes "bits/time.h" _directly_. The file "sys/time.h" has an ifdef system like this: #ifndef _TIMEVAL_DEFIN

 

Related content

c programming error redefinition of

c programming error redefinition of p here for a quick overview of the site Help Center Detailed answers to any questions you error redefinition of class c might have Meta Discuss the workings and policies of this site Error Redefinition Of Typedef About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting error redefinition of typedef gliststore 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 Error Redefinition Of class million programmers just like you helping

c compile error redefinition

c compile error redefinition p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and error redefinition of class c policies of this site About Us Learn more about Stack Overflow the Error Redefinition Of Typedef company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags error redefinition of typedef gliststore Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it

c error redefinition

c error redefinition p here for a quick overview of the site Help Center Detailed answers to any questions error redefinition of struct node you might have Meta Discuss the workings and policies of this Error Redefinition Of Class C site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers error redefinition of typedef 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 Error Redefinition Of Typedef gliststore community of million programmers just like you helping each

compile error redefinition

compile error redefinition p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings error redefinition of typedef and policies of this site About Us Learn more about Stack Overflow Error Redefinition Of Typedef gliststore the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation error redefinition of class Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it error redefinition

apache make error redefinition

apache make error redefinition p contribution towards the costs the time error redefinition of typedef gliststore and effort that's going in this site and building Thank You error redefinition of class Steffen Apache Lounge is not sponsored by anyone Your donations will help to keep this site alive and well Error Redefinition Of class and continuing the building of the binaries Compilation problem with Apache configuration LDAP Apache Forum Index - Apache Building Member Downloads View previous topic View next topic Author Message sasi Joined Error Redefinition Of C Jun Posts Location USA CT Posted Mon Jun ' Post subject

error redefinition of nion semun

error redefinition of nion semun p 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 million programmers just like you helping each other Join them it only takes a minute Sign up Compilation error Redefinition of union name up

error redefinition different linkage

error redefinition different linkage p here for a quick overview of the site Help Center Detailed error redefinition of typedef answers to any questions you might have Meta Discuss the Error Redefinition Of Typedef gliststore workings and policies of this site About Us Learn more about Stack Overflow the company error redefinition of class Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join error redefinition of class the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other

error redefinition of stat

error redefinition of stat p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies error redefinition of typedef of this site About Us Learn more about Stack Overflow the company Business error redefinition of typedef gliststore Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges error redefinition of class Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it only

error redefinition of typedef uintptr_t

error redefinition of typedef uintptr t p 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 typedef redefinition with different types xcode company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Typedef Undef Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million duplicate typedef programmers just like you helping each other Join them it only takes

error redefinition of struct in6_addr

error redefinition of struct in addr p Miller davem davemloft net Cc libc-alpha sourceware org amwang redhat com yoshfuji linux-ipv org netdev vger kernel org linux-kernel vger kernel org libvirt-list redhat com tgraf suug ch schwab suse de bhutchings solarflare com vapier gentoo org tmb mageia org Subject Re libvirt Redefinition of struct in addr in netinet in h and linux in h Date Wed Jan - On PM David Miller wrote From Mike Frysinger vapier gentoo org Date Wed Jan - certainly true but the current expectation is that you don't mix your ABIs if you're programming with the

error redefinition of

error redefinition of p 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 million programmers just like you helping each other Join them it only takes a minute Sign up GCC compiler error ldquo redefinition hellip previously defined rdquo

error redefinition

error redefinition p 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 Error Redefinition Of Typedef Learn more about Stack Overflow the company Business Learn more about hiring developers error redefinition of class or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Error Redefinition Of class Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it only takes a minute

error redefinition of previously declared here

error redefinition of previously declared here p 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 million programmers just like you helping each other Join them it only takes a minute Sign up Redefinition of hellip previously declared here

error redefinition different storage class

error redefinition different storage class p resources Windows Server resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community error redefinition of class c Magazine Forums Blogs Channel Documentation APIs and reference Dev centers error redefinition of class Retired content Samples We re sorry The content you requested has been removed You ll be auto redirected error redefinition of typedef in second C C Building Reference C C Build Errors Compiler Errors C Through C Compiler Errors C Through C Compiler Error C Compiler Error C Compiler Error Redefinition Of Typedef gliststore

error redefinition of group name

error redefinition of group name p 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 error redefinition of typedef site About Us Learn more about Stack Overflow the company Business Learn error redefinition of typedef gliststore more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question Error Redefinition Of class x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it

error redefinition of function c

error redefinition of function c p 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 error redefinition of class c Stack Overflow the company Business Learn more about hiring developers or posting ads Error Redefinition Of Typedef with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow Error Redefinition Of Typedef gliststore is a community of million programmers just like you helping each other Join them

error redefinition of main

error redefinition of main p 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 Error Redefinition Of Typedef Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is error redefinition of typedef gliststore a community of million programmers just like you helping each other Join them it only takes a minute Sign

error redefinition function

error redefinition function p 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 Redefinition Of Function Error In C hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges error redefinition of typedef Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each error redefinition of typedef gliststore other Join them it

error redefinition different basic types

error redefinition different basic types p 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 error redefinition of typedef About Us Learn more about Stack Overflow the company Business Learn more about Error Redefinition Of Typedef gliststore hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join error redefinition of class the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it

error redefinition of operator

error redefinition of operator p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss error redefinition of typedef the workings and policies of this site About Us Learn more about Error Redefinition Of Typedef gliststore Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow error redefinition of class Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each Error Redefinition Of class other

error redefinition of template class

error redefinition of template class p here for a quick overview of the site Help Center Detailed answers to any questions you might have error redefinition of class c Meta Discuss the workings and policies of this site About Us Error Redefinition Of class Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with error redefinition of typedef us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just error redefinition of typedef gliststore like you helping

error redefinition make

error redefinition make p 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 error redefinition of typedef or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x error redefinition of typedef gliststore Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it error redefinition of class only takes

error redefinition different

error redefinition different p 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 error redefinition of typedef Us Learn more about Stack Overflow the company Business Learn more about hiring Error Redefinition Of Typedef gliststore developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join error redefinition of class the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it only takes

error redefinition in c

error redefinition in c p 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 Error Redefinition Of Class C Stack Overflow the company Business Learn more about hiring developers or posting ads error redefinition of typedef with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow Error Redefinition Of Typedef gliststore is a community of million programmers just like you helping each other Join them it

gcc error redefinition struct

Gcc Error Redefinition Struct p 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 error redefinition of c this site About Us Learn more about Stack Overflow the company Business Error Redefinition Of C Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask c error redefinition of function Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it only