nefarius / ViGEmClient

ViGEm Client SDK for feeder development.
https://docs.nefarius.at/projects/ViGEm/
MIT License
134 stars 65 forks source link

Cannot compile the lib #5

Closed ya-isakov closed 4 years ago

ya-isakov commented 5 years ago

Describe the bug I cannot compile the c++ library, compiler breaks with 'mem_fn' : is not a member of 'std'

To Reproduce msbuild ViGEmClient.sln

Expected behavior Library is built :)

Screenshots N/A

System details (please complete the following information):

Additional context I think that include <functional> is missing from ViGEmClient.cpp. I've added it, and library is compiled.

nefarius commented 5 years ago

Hi, on the master branch? Probably something I f00ped up when working on the rumble bugfix - which I should finally merge ๐Ÿ˜…

michael-fadely commented 5 years ago

master builds for me!

ya-isakov commented 5 years ago

Yes, I'm on master, and it doesn't work for me 100% of times I tried to build it. Here is the log https://gist.github.com/ya-isakov/fbbf6d23455d92bf6328c964f325e65d. I'm using Build Tools for Visual Studio 2019, btw, so my assumption is that new version of compiler is requiring explicit use of <functional>. I found similar problem https://stackoverflow.com/questions/24580416/mem-fun-is-not-a-member-of-std, and including a <functional> solved it.

ya-isakov commented 5 years ago

So, yes, the problem is in MSBuild Tools 2019, ViGEmClient could be successfully compiled with MSBuild Tools 2017.

nefarius commented 5 years ago

Interesting, thanks for the details.

nefarius commented 4 years ago

In the meantime it builds fine on VS 2019 as well, can anyone confirm besides me and AppVeyor? ๐Ÿ˜‰

ttsuki commented 4 years ago

I using VS2019 got same result as @ya-isakov error C2039: 'mem_fn': 'std' ใฎใƒกใƒณใƒใƒผใงใฏใ‚ใ‚Šใพใ›ใ‚“ใ€‚ (My environment is Japanese).

And I confirmed latest VS2019 (16.3.8 VC++19.23.28106.4) and latest VS2019 Preview(16.4.0.preview 4.0 VC++ 19.24.28218.2) are in the same result.

I think this problem is due to physical optimization of std library in vs2019 documented in https://docs.microsoft.com/ja-jp/cpp/overview/what-s-new-for-visual-cpp-in-visual-studio?view=vs-2019

Optimized the standard library physical design to avoid compiling parts of the standard library not directly included. This change cut the build time of an empty file that includes only in half. As a consequence, you may need to add #include directives for headers that were previously indirectly included. For example, code that uses std::out_of_range may now need to add #include . Code that uses a stream insertion operator may now need to add #include . The benefit is that only translation units actually using or components pay the throughput cost to compile them.

I compiled it successfully by adding #include <functional> to ViGEmClient.cpp, too

as https://github.com/ttsuki/ViGEmClient/commit/f5afc4b656662280d1473d5477c759ac692cb205

FYI, thanks.

nefarius commented 4 years ago

I upgraded to VS 2019, let's see how this works :)

nefarius commented 4 years ago

Fixed ๐ŸŽ‰