Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'timespec': 'struct' type redefinition error when compile in VS2019/17 #1

Open
VadymKargin opened this issue Jun 17, 2019 · 4 comments

Comments

@VadymKargin
Copy link

VadymKargin commented Jun 17, 2019

Hi,

I tried to compile this in VS2019 and 2017 and it gives following error:
error C2011: 'timespec': 'struct' type redefinition

Do we have to add
#define HAVE_STRUCT_TIMESPEC
in pthread.h with a condition for VS builds?

Thanks

@glgoo
Copy link

glgoo commented Jan 6, 2020

You can add #define HAVE_STRUCT_TIMESPEC to include file <pthread.h>

@DrIxionerr
Copy link

DrIxionerr commented Jun 14, 2021

With VS 2019, the following lines are no longer needed:

pthread.h : l.318-324

#if !defined(_TIMESPEC_DEFINED)
#define _TIMESPEC_DEFINED
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif /* _TIMESPEC_DEFINED */

Indeed, with VS2019, time_spec is already defined like this.
It would be interesting to change these lines (delete them or add a condition "if the VS redist is 2017 or more").

@katonpang
Copy link

katonpang commented May 4, 2022

I took out line 318-324 and I still have problem compiling. Now I have LNK2019 error afterward. What can I do to fix this? I'm using VS2022 not sure if it'd make a different.

@goshante
Copy link

Building such things always painful on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants