I am trying to compile multiple thirdparty library gist and pthread on windows10 using mingw32_make. However, i am getting redefinition error coming from line "#define PTW32_LEVEL 1".
Q1) Is it that the "#undef PTW32_LEVEL" didn't work at all? That doesn't sound right.
I have already looked at this and this "PTW32_LEVEL" isn't predefined by compiler as defined here.
Q2) what am i missing here? possible workarounds?
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
There are other redefinitions as well but the summary is same.
Error:
make
gcc -c -Wall -O3 -g gist.c -ID:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include -DUSE_GIST -DSTANDALONE_GIST
In file included from gist.c:15:0:
D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/pthread.h:108:0: warning: "PTW32_LEVEL" redefined
#define PTW32_LEVEL PTW32_LEVEL_MAX
D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/pthread.h:95:0: note: this is the location of the previous definition
#define PTW32_LEVEL 1
In file included from D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/pthread.h:299:0,
from gist.c:15:
D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/sched.h:64:0: warning: "PTW32_SCHED_LEVEL" redefined
#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/sched.h:51:0: note: this is the location of the previous definition
#define PTW32_SCHED_LEVEL 1
In file included from gist.c:15:0:
D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/pthread.h:320:8: error: redefinition of 'struct timespec'
struct timespec {
^~~~~~~~
In file included from D:\prjs\im-similarity\repo\pthreads-w32-2-9-1-release\Pre-built.2\include/pthread.h:219:0,
from gist.c:15:
c:\mingw\include\time.h:115:8: note: originally defined here
struct timespec
^~~~~~~~
Makefile:17: recipe for target 'gist.o' failed
make: *** [gist.o] Error 1
Header:
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_LEVEL_MAX 3
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif