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

[Bug]: algorithm\container.h is missing random header and causing compilation error when building protobuf in VS2022 #1676

Closed
scfwilson opened this issue May 21, 2024 · 1 comment
Assignees

Comments

@scfwilson
Copy link

scfwilson commented May 21, 2024

Describe the issue

What happened

I have built a gRPC 1.62.1 C++ nuget package using cmake.

When I consume this gRPC package in my project I get the errors shown below. After investigating it the compilation error is happening when we compile the protobuf generated code. This code uses the algorthim\container.h which implements the c_sample(). This uses the std::uniform_int_distribution.

The solution seems to be if you include the random header in container.h the compilation errors do not occur.

This has also been reported against protobuf 16475

Steps to reproduce the problem

Create a simple proto file and run the protoc.exe against it to generate C++ files.
Now using VS2022 compile the file and you will get
1>C:\Git\spectrum.pagehandlerclient\packages\grpc.cpp.static.x64.1.62.1\build\native\x64\Debug\include\absl\algorithm\container.h(797,14): error C2039: 'uniform_int_distribution': is not a member of 'std' 1>(compiling source file 'codegen/PageServiceV1.grpc.pb.cc') 1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include\unordered_set(23,1): 1>see declaration of 'std'

What version of Abseil are you using?

Abseil 20240116.0
Protobuf v3.25.1
gRPC 1.621

What operating system and version are you using?

Windows 11
Version 22H2 (22621.3447)

What compiler and version are you using?

Microsoft Visual Studio Enterprise 2022 (2) (64-bit) - Current
Version 17.9.6

What build system are you using?

NA

Additional context

No response

@derekmauro derekmauro self-assigned this May 21, 2024
@derekmauro
Copy link
Member

Thank you for reporting. This will be fixed shortly.

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

2 participants