inspirit / PS3EYEDriver

PS3EYE Camera Driver for OSX and Windows
Other
316 stars 92 forks source link

New pull request without MSVC build files. #39

Closed mbehensky closed 8 years ago

mbehensky commented 8 years ago

I removed the visual studio build files from my master branch, and updated the instructions so it tells you how to set up the MSVC projects. I moved the README.msvc file into the top level directory. The patches to allow USBMgr to compile and disable the warnings for libusb.h are still there.

cboulay commented 8 years ago

Can you rebase to clean up the commit history a little?

I'm not sure but the warnings might exist in other build systems too. I'll check now (just want to post this quickly). If so then is disabling the warning the same for all platforms, or is that command MSVC-specific? Edit: No warning in Mac. Going to try Linux next... Edit2: Duh... I forgot Linux has native drivers in the kernel making this project unnecessary there.

Finally, can you describe the USBMgr error a little more? I use a couple different projects that depend on PS3EYEDriver and both of them compile in Windows just fine using MSVC2013 or MSVC2015, so there has to be something else going wrong here than MSVC refusing to compile standard syntax.

mbehensky commented 8 years ago

Here are the errors I get with MSVC 2013, using the unmodified ps3eye.cpp:

....\PS3EYEDriver\src\ps3eye.cpp(330): error C2664: 'std::atomic_bool::atomic_bool(const std::atomic_bool &)' : cannot convert argument 1 from 'bool' to 'const std::atomic_bool &' 1> Reason: cannot convert from 'bool' to 'const std::atomic_bool' 1> No constructor could take the source type, or constructor overload resolution was ambiguous 1>....\PS3EYEDriver\src\ps3eye.cpp(330): error C2664: 'std::atomic_int::atomic_int(const std::atomic_int &)' : cannot convert argument 1 from 'int' to 'const std::atomic_int &' 1> Reason: cannot convert from 'int' to 'const std::atomic_int' 1> No constructor could take the source type, or constructor overload resolution was ambiguous 1> ps3eye_capi.cpp

The code looks fine to me, and seems like it should compile. From the errors, and clicking on things with intellisense, it looks like there is no constructor for the std::atomic_bool that takes a bool as input, and no constructor for std::atomic_int that takes an int as input. I would think that those constructors should exist, but after googling around for a while yesterday I came up empty. It looks like a problem with Microsoft's implementation of the std::atomic stuff. I don't know why it works for you and not me. It may be that I have a different patch level for MSVC than you do.

I got it to work by ditching the initializers and alowing the default constructors to run. I then set them to the right values in the constructor function. I don't see any problem with this, on any platform.

As for the warnings, lots of people complain about this warning from libusb.h. Disabling the warning for MSVC only, and only for the libusb include, seems like a good thing to do. Having a page of warnings every time you include ps3eye.h makes it hard to develop your code.

I'm not sure how to do the rebase you want. I'll see if I can figure it out.

mbehensky commented 8 years ago

OK, I rebased my master branch with a single commit with those changes.

cdoty commented 8 years ago

Beautiful, this builds without any issues, and works well. Thanks to all involved in getting this working correctly.