ghostlander / nsgminer

NeoScrypt OpenCL GPU Miner
https://bitcointalk.org/index.php?topic=712650.0
GNU General Public License v3.0
97 stars 68 forks source link

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

Open thnass opened 8 years ago

thnass commented 8 years ago

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"

ghostlander commented 8 years ago

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.

akkida746 commented 7 years ago

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