Reputation: 6871
const char* hi = "hi"; // ok
const char* hi2 = u8"hi"; // compile error
It causes
error: use of undeclared identifier 'u8'
My compiler supports C++ 11
.
~/Project/cpp c++ -v
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
Upvotes: 2
Views: 2212
Reputation: 81986
Your compiler doesn't default to C++11 though.
[9:46pm][wlynch@watermelon /tmp] c++ -c blah.cc
blah.cc:2:19: error: use of undeclared identifier 'u8'
const char* hi2 = u8"hi"; // compile error
^
blah.cc:2:21: error: expected ';' after top level declarator
const char* hi2 = u8"hi"; // compile error
^
;
2 errors generated.
[9:47pm][wlynch@watermelon /tmp] c++ -c -std=c++11 blah.cc
[9:47pm][wlynch@watermelon /tmp]
Upvotes: 10