I want to use a C++11 standard library, regex
, in Xcode 5 but I was faced with an error:
Lexical or Preprocessor Issue, 'regex' file not found.
OS: OSX 10.9 (Mavericks)
XCode: Version 5.1.1
Build Setting:
I changed just Apple LLVM 5.1 settings.
C++ Language Dialect -- C++11[-std=c++11]
C++ Standard Library -- libc++(LLVM C++ Standard Library with C++11 support)
Enable C++ Exceptions -- yes
Enable C++ Runtime Types -- yes
Code:
#include <regex> #include <iostream> int main(void) { auto reg = std::regex("(hello)+"); auto words = "hello hellohello h e l l o"; std::cout << std::boolalpha << std::regex_match(words, reg) << std::endl; }
How can I fix this?