alibaba / yalantinglibs

A collection of modern C++ libraries, include coro_rpc, struct_pack, struct_json, struct_xml, struct_pb, easylog, async_simple
https://alibaba.github.io/yalantinglibs/
Apache License 2.0
1.56k stars 240 forks source link

wsl2 ubuntu 24.04 编译报错 #822

Closed CBookShu closed 1 week ago

CBookShu commented 1 week ago

Search before asking

What happened + What you expected to happen

wsl2 ubuntu 24.04 环境,cmake 默认编译报错

In file included from /home/yalantinglibs/include/ylt/reflection/member_ptr.hpp:2, from /home/yalantinglibs/include/ylt/reflection/member_names.hpp:5, from /home/yalantinglibs/include/ylt/reflection/member_value.hpp:7, from /home/yalantinglibs/src/reflection/tests/test_reflection.cpp:4: /home/yalantinglibs/include/ylt/reflection/member_count.hpp:15:23: error: 'uint64_t' has not been declared 15 | template <typename T, uint64_t version>

Reproduction way

我自己尝试该环境是必现的

Anything else

在 <ylt/reflection/member_count.hpp> 添加: #include <cstdint> 随后,编译通过,但是有以下的报警,我就忽略了

In file included from /home/yalantinglibs/include/ylt/struct_pack/alignment.hpp:20, from /home/yalantinglibs/include/ylt/struct_pack.hpp:23, from /home/yalantinglibs/include/ylt/coro_rpc/impl/errno.h:17, from /home/yalantinglibs/include/ylt/coro_rpc/impl/coro_connection.hpp:35, from /home/yalantinglibs/include/ylt/coro_rpc/impl/context.hpp:29, from /home/yalantinglibs/include/ylt/coro_rpc/impl/coro_rpc_client.hpp:51, from /home/yalantinglibs/include/ylt/coro_rpc/coro_rpc_client.hpp:17, from /home/yalantinglibs/src/coro_rpc/tests/test_coro_rpc_server.cpp:21: /home/yalantinglibs/include/ylt/struct_pack/reflection.hpp: In member function 'std::vector<std::byte> coro_rpc::coro_rpc_client::prepare_buffer(uint32_t&, Args&& ...) [with auto func = large_arg_fun; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}]': /home/yalantinglibs/include/ylt/struct_pack/reflection.hpp:297:13: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=] 297 | memcpy(buffer, data, len);

Are you willing to submit a PR?

qicosmos commented 1 week ago

第一个问题看起来是缺少这个头文件,稍后我加一下,或者你提个pr加一下都行。 第二个告警问题是误报可以忽略。

CBookShu commented 1 week ago

第一个问题看起来是缺少这个头文件,稍后我加一下,或者你提个pr加一下都行。 第二个告警问题是误报可以忽略。

好的,我本地自己修改用起来了,就不提PR了,这里反馈一下就好。