batterycenter / embed

A CMake/C++20 library to embed resource files at compile time
Apache License 2.0
116 stars 4 forks source link

std::copy_n is defined in <algorithm> #7

Closed kainiederhagen closed 4 months ago

kainiederhagen commented 4 months ago

Since embed.hpp uses std::copy_n it should include the header as well.

https://en.cppreference.com/w/cpp/algorithm/copy_n

https://github.com/batterycenter/embed/blob/73de31488b64f2eef1eda6ebdda2a893bc87923a/CMakeLists.txt#L181

HerrNamenlos123 commented 4 months ago

In what Compiler on what Platform does this cause an issue? I will add it but I haven't had an issue with that in all compilers I tested...

kainiederhagen commented 4 months ago

It failed under windows with gcc 14.1.0.

Clang under windows seems to be using the msvc std lib, therefore it can find std::copy_n

I'd expect both gcc and clang to fail under linux.

0xFEEDCAFE commented 4 months ago

I can confirm, that the algorithm header is indeed missing and thus the code fails to build on Linux with Clang 15 and GCC 12.3.

HerrNamenlos123 commented 4 months ago

I just added the header and it should work without issues now

kainiederhagen commented 4 months ago

Thank you!