From ae5a2c345d47f60075b2634f560206ddb255fe2c Mon Sep 17 00:00:00 2001 From: German Lashevich Date: Sun, 29 May 2022 20:10:00 +0200 Subject: [PATCH] Fix build issues - `std::copy_n` requires to #include - `std::optional` requires C++17 or newer --- CMakeLists.txt | 2 +- src/ipc-util.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 404e9e2..11fbf30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ target_link_libraries(i3ipc++ ) target_compile_options(i3ipc++ - PRIVATE -std=c++11 -Wall -Wextra -Wno-unused-parameter + PRIVATE -std=c++17 -Wall -Wextra -Wno-unused-parameter ) target_compile_definitions(i3ipc++ diff --git a/src/ipc-util.cpp b/src/ipc-util.cpp index 2ba7fe1..6847d7f 100644 --- a/src/ipc-util.cpp +++ b/src/ipc-util.cpp @@ -8,6 +8,7 @@ extern "C" { #include } +#include #include #include @@ -30,7 +31,7 @@ errno_error::errno_error(const std::string& msg) : ipc_error(format_errno(msg)) static const std::string g_i3_ipc_magic = "i3-ipc"; -buf_t::buf_t(uint32_t payload_size) : +buf_t::buf_t(uint32_t payload_size) : data(sizeof(header_t) + payload_size, 0), header(reinterpret_cast(data.data())), payload(reinterpret_cast(data.data() + sizeof(header_t))) @@ -54,7 +55,7 @@ int32_t i3_connect(const std::string& socket_path) { } (void)fcntl(sockfd, F_SETFD, FD_CLOEXEC); // What for? - + struct sockaddr_un addr; memset(&addr, 0, sizeof(struct sockaddr_un)); addr.sun_family = AF_LOCAL;