I was programming a C++ code today. Then, I got an error “error: unable to find string literal operator ‘operator””s’ with ‘const char [12]’, ‘long unsigned int’ arguments”. Because I did not set using namespace std::literals.”

I got the error with a code below.

auto str2 = "Test Phase"s;

Solved the issue by adding a line of code below.

using namespace std::literals;

If you still get the same error, make sure you set compiler C++14. See the code below in CMake.

set(CMAKE_CXX_STANDARD 14)

Now, my code compiled with no errors.