I am using Catch2 from the actual devel
branch and I have a linker error when trying to compare two vector<string_view>
The issue can be reproduced as following:
#include <vector>
#include <string_view>
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Can split string", "[split]") {
vector<string_view> splittedString = {"this is a string view"sv};
vector<string_view> EXPECTED = {"I'm"sv, "Elvis"sv,"Dukaj"sv};
REQUIRE(splittedString == EXPECTED);
}
My CMakeLists.txt
:
find_package(Catch2 REQUIRED)
# ...
target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2WithMain)
When trying to build I have the following linker error:
Catch2/src/catch2/../catch2/catch_tostring.hpp:126: error: undefined reference to `Catch::StringMaker<std::basic_string_view<char, std::char_traits<char> >, void>::convert[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)'
What am I doing wrong? Am I missing some includes?
catch2/catch_matchers_all.hpp
as well. – Nudicauldevelop
branch? That's not intended for production use. – Lichiv2.x
branch and chaneged the include with#include <catch2/catch.hpp>
and I have still the same problem. – Macnamarastd::string_view
matcher as well. I think it was limited to C++17 in the Catch2 sources and I was using some combination like Clang on Windows that was not recognized by that. – Nudicauldevelop
branch is the oldmaster
so is something that is super stable in theory – Macnamara#include <catch2/matchers/catch_matchers_all.hpp>
but the problem is still here. – Macnamara