nsgminer icon indicating copy to clipboard operation
nsgminer copied to clipboard

Having difficulty building on windows with "redefinition of 'struct timespec

Open thnass opened this issue 9 years ago • 2 comments

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 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"

thnass avatar Jan 02 '16 06:01 thnass

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.

ghostlander avatar Jan 02 '16 12:01 ghostlander

I got the same error in Ecliepse Neon IDE and i resolved it by adding '-DHAVE_STRUCT_TIMESPEC' in C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous -> Others flag

redefinition of struct timespec

akkida746 avatar Jun 28 '17 07:06 akkida746