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?