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

Cannot build using Visual Studio 2015 CTP #63

Closed
deisenhut opened this issue Apr 14, 2015 · 5 comments
Closed

Cannot build using Visual Studio 2015 CTP #63

deisenhut opened this issue Apr 14, 2015 · 5 comments
Labels

Comments

@deisenhut
Copy link

I am attempting to build libusb-1.0.19 on Windows using Visual Studio 2015 CTP. It builds fine when using Visual Studio 2013 with just a couple of deprecation warnings, but using Visual Studio 2015 CTP I get the following errors. Note, I used the 2013 solution file and let VS upgrade the projects. The only difference I see in the solution and project files are changes in the version number.

1>------ Build started: Project: libusb-1.0 (static), Configuration: Debug Win32 ------
2>------ Build started: Project: getopt, Configuration: Debug Win32 ------
3>------ Build started: Project: libusb-1.0 (dll), Configuration: Debug Win32 ------
1> core.c
3> core.c
1>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
1> descriptor.c
2> getopt1.c
2> getopt.c
2> Generating Code...
3>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
3> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
3> descriptor.c
1>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
1> hotplug.c
3>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
3> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
3> hotplug.c
2> getopt_2015.vcxproj -> D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\msvc..\Win32\Debug\lib\getopt.lib
1>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
1> io.c
3>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
3> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
3> io.c
1>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
1>..\libusb\io.c(1224): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data
1>..\libusb\io.c(1902): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data
1>..\libusb\io.c(2423): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data
1> poll_windows.c
3>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
3> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
3>..\libusb\io.c(1224): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data
3>..\libusb\io.c(1902): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data
3>..\libusb\io.c(2423): warning C4244: '=': conversion from 'time_t' to 'long', possible loss of data
3> poll_windows.c
1>D:\Perforce\my-project\3rdParty\Libusb\OriginalSource\libusb-1.0.19\libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\10\Include\ucrt\time.h(39): note: see declaration of 'timespec'
….. These errors continue …...

We are utilizing VS2015 because of support in it for C++11. We’ve had problems in the past with linking components built with different VS versions together, so would like to use VS2015 for everything (including libraries such as this). But for now we’ll have to use a VS2013 built version.

@deisenhut
Copy link
Author

I have created 2015 VS project files (and a corresponding 2015 solution file) that include the preprocessor definition of HAVE_STRUCT_TIMESPEC. With this change, the build succeeds. There are a couple more compile warnings with VS2015 (C4244: '=': conversion from 'time_t' to 'long', possible loss of data), but it successfully builds.

@Zangetsu38
Copy link

@deisenhut How you did to solve the problem exactly?

@daneisenhut
Copy link

In each of the project files, I included HAVE_STRUCT_TIMESPEC within the PreprocessorDefinitions tag. Each project file had four instances of this tag that I modified.

<PreprocessorDefinitions>HAVE_STRUCT_TIMESPEC;WIN32;__GNU_LIBRARY__;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

@Zangetsu38
Copy link

Ok thx :)

@dickens
Copy link
Member

dickens commented Jan 6, 2016

Issue resolved via a34ba28

@dickens dickens closed this as completed Jan 6, 2016
@mcuee mcuee added the windows label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants