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

uniform_int_distribution not a member of "std" ? #16475

Open
try-agaaain opened this issue Apr 11, 2024 · 0 comments
Open

uniform_int_distribution not a member of "std" ? #16475

try-agaaain opened this issue Apr 11, 2024 · 0 comments
Labels
untriaged auto added to all issues by default when created.

Comments

@try-agaaain
Copy link

Running environment: Windows11 x86_64 protobuf-26.1 C++

I installed the 26.1 version of protobuf and compiled it through Visual Studio 2022. Subsequently, I added \protobuf-26.1\src\google and protobuf-26.1\third_party\abseil-cpp\absl to the include files, But after I generated .pb.h and .pb.cc files through protoc.exe, the following problem occurred:

严重性	代码	说明	项目	文件	行	禁止显示状态
错误	C2039	"uniform_int_distribution": 不是 "std" 的成员	day09-protobuf-demo	D:\Development\protobuf\protobuf_dev\include\absl\algorithm\container.h	797	

I learned that uniform_int_distribution appears in C++11 and exists in the random library, and the corresponding symbol can also be found in my Visual Studio:

image

Is there a reason for this error?

A more detailed error message is as follows:

error information

已启动重新生成...
1>------ 已启动全部重新生成: 项目: day09-protobuf-demo, 配置: Debug x64 ------
1>day09-protobuf-demo.cpp
1>msg.pb.cc
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\coded_stream.h(1266,28): warning C4251: “google::protobuf::io::CodedOutputStream::default_serialization_deterministic_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::io::CodedOutputStream”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\atomic(2686): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(411,22): warning C4251: “google::protobuf::internal::SerialArena::ptr_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::SerialArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(411): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(421,29): warning C4251: “google::protobuf::internal::SerialArena::string_block_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::SerialArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(421): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(426,23): warning C4251: “google::protobuf::internal::SerialArena::string_block_unused_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::SerialArena”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\atomic(2698): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(428,28): warning C4251: “google::protobuf::internal::SerialArena::head_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::SerialArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(428): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(429,23): warning C4251: “google::protobuf::internal::SerialArena::space_used_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::SerialArena”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\atomic(2698): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\serial_arena.h(430,23): warning C4251: “google::protobuf::internal::SerialArena::space_allocated_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::SerialArena”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\atomic(2698): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\thread_safe_arena.h(138,29): warning C4251: “google::protobuf::internal::ThreadSafeArena::alloc_policy_”: class“google::protobuf::internal::TaggedAllocationPolicyPtr”需要有 dll 接口由 class“google::protobuf::internal::ThreadSafeArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\arena_allocation_policy.h(41): message : 参见“google::protobuf::internal::TaggedAllocationPolicyPtr”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\thread_safe_arena.h(139,30): warning C4251: “google::protobuf::internal::ThreadSafeArena::arena_stats_”: class“google::protobuf::internal::ThreadSafeArenaStatsHandle”需要有 dll 接口由 class“google::protobuf::internal::ThreadSafeArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\arenaz_sampler.h(175): message : 参见“google::protobuf::internal::ThreadSafeArenaStatsHandle”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\thread_safe_arena.h(142,15): warning C4251: “google::protobuf::internal::ThreadSafeArena::mutex_”: class“absl::Mutex”需要有 dll 接口由 class“google::protobuf::internal::ThreadSafeArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\absl\synchronization\mutex.h(151): message : 参见“absl::Mutex”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\thread_safe_arena.h(144,34): warning C4251: “google::protobuf::internal::ThreadSafeArena::head_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::ThreadSafeArena”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\thread_safe_arena.h(144): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\thread_safe_arena.h(241,39): warning C4251: “google::protobuf::internal::ThreadSafeArena::lifecycle_id_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::ThreadSafeArena”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\atomic(2698): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\arenastring.h(60,43): warning C4251: “google::protobuf::internal::LazyString::inited_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::LazyString”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\arenastring.h(60): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\metadata_lite.h(248,15): warning C4251: “google::protobuf::internal::LiteUnknownFieldSetter::buffer_”: class“std::basic_string,std::allocator>”需要有 dll 接口由 class“google::protobuf::internal::LiteUnknownFieldSetter”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\xstring(4919): message : 参见“std::basic_string,std::allocator>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\message_lite.h(117,23): warning C4251: “google::protobuf::internal::CachedSize::atom_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::CachedSize”的客户端使用
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\atomic(2693): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\absl\algorithm\container.h(797,14): error C2039: "uniform_int_distribution": 不是 "std" 的成员
1>D:\Development\VisualStudio2022\VC\Tools\MSVC\14.32.31326\include\unordered_set(24): message : 参见“std”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(618,7): warning C4251: “google::protobuf::internal::ExtensionSet::maybe_create_lazy_extension_”: struct“std::atomic”需要有 dll 接口由 class“google::protobuf::internal::ExtensionSet”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(617): message : 参见“std::atomic”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1085,26): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_int32_t_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(285): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1086,26): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_int64_t_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(498): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1087,27): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_uint32_t_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(500): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1088,27): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_uint64_t_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(502): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1089,25): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_double_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(518): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1090,24): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_float_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(516): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\extension_set.h(1091,23): warning C4251: “google::protobuf::internal::RepeatedPrimitiveDefaults::default_repeated_field_bool_”: class“google::protobuf::RepeatedField”需要有 dll 接口由 class“google::protobuf::internal::RepeatedPrimitiveDefaults”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\wire_format_lite.h(520): message : 参见“google::protobuf::RepeatedField”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2412,7): warning C4251: “google::protobuf::DescriptorPool::dispatcher_”: class“std::unique_ptr) const>,std::default_delete) const>>>”需要有 dll 接口由 class“google::protobuf::DescriptorPool”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2411): message : 参见“std::unique_ptr) const>,std::default_delete) const>>>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2418,27): warning C4251: “google::protobuf::DescriptorPool::tables_”: class“std::unique_ptr>”需要有 dll 接口由 class“google::protobuf::DescriptorPool”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2418): message : 参见“std::unique_ptr>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2431,42): warning C4251: “google::protobuf::DescriptorPool::unused_import_track_files_”: class“absl::flat_hash_map>>”需要有 dll 接口由 class“google::protobuf::DescriptorPool”的客户端使用
1>        with
1>        [
1>            K=std::string,
1>            V=bool
1>        ]
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2431): message : 参见“absl::flat_hash_map>>”的声明
1>        with
1>        [
1>            K=std::string,
1>            V=bool
1>        ]
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2435,39): warning C4251: “google::protobuf::DescriptorPool::feature_set_defaults_spec_”: class“std::unique_ptr>”需要有 dll 接口由 class“google::protobuf::DescriptorPool”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\descriptor.h(2435): message : 参见“std::unique_ptr>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(234,30): warning C4251: “google::protobuf::io::CopyingInputStreamAdaptor::buffer_”: class“std::unique_ptr>”需要有 dll 接口由 class“google::protobuf::io::CopyingInputStreamAdaptor”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(234): message : 参见“std::unique_ptr>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(328,30): warning C4251: “google::protobuf::io::CopyingOutputStreamAdaptor::buffer_”: class“std::unique_ptr>”需要有 dll 接口由 class“google::protobuf::io::CopyingOutputStreamAdaptor”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(234): message : 参见“std::unique_ptr>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(402,28): warning C4251: “google::protobuf::io::CordInputStream::it_”: class“absl::Cord::CharIterator”需要有 dll 接口由 class“google::protobuf::io::CordInputStream”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\absl\strings\cord.h(615): message : 参见“absl::Cord::CharIterator”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(486,14): warning C4251: “google::protobuf::io::CordOutputStream::cord_”: class“absl::Cord”需要有 dll 接口由 class“google::protobuf::io::CordOutputStream”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\absl\strings\cord.h(172): message : 参见“absl::Cord”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\io\zero_copy_stream_impl_lite.h(489,20): warning C4251: “google::protobuf::io::CordOutputStream::buffer_”: class“absl::CordBuffer”需要有 dll 接口由 class“google::protobuf::io::CordOutputStream”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\absl\strings\cord_buffer.h(105): message : 参见“absl::CordBuffer”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\unknown_field_set.h(190,29): warning C4251: “google::protobuf::UnknownFieldSet::fields_”: class“std::vector>”需要有 dll 接口由 class“google::protobuf::UnknownFieldSet”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\unknown_field_set.h(190): message : 参见“std::vector>”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\map.h(761,13): warning C4251: “google::protobuf::internal::UntypedMapBase::alloc_”: class“google::protobuf::internal::MapAllocator”需要有 dll 接口由 class“google::protobuf::internal::UntypedMapBase”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\map.h(509): message : 参见“google::protobuf::internal::MapAllocator”的声明
1>D:\Development\protobuf\protobuf_dev\include\google\protobuf\message.h(1001,27): warning C4251: “google::protobuf::Reflection::tcparse_table_once_”: class“absl::once_flag”需要有 dll 接口由 class“google::protobuf::Reflection”的客户端使用
1>D:\Development\protobuf\protobuf_dev\include\absl\base\call_once.h(87): message : 参见“absl::once_flag”的声明
1>正在生成代码...
1>已完成生成项目“day09-protobuf-demo.vcxproj”的操作 - 失败。
========== “全部重新生成”: 0 成功,1 失败,0已跳过 ==========
@try-agaaain try-agaaain added the untriaged auto added to all issues by default when created. label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant