Chào mọi người mình hiện mới chuyển sang môi trường Linux (rõ hơn mình đang dùng RedHat) để lập trình.
Hiện mình dùng GCC ver 4.4.7:
Mình có viết một chương trình C++ như sau:
   #include <iostream>
   #include <fstream>
   #include <regex>
   
   using namespace tr1;
   using namespace std;
   
   int main()
   {
  std::string str = "Hello world";
  std::tr1::regex rx("ello");
  
  if(regex_match(str.begin(), str.end(), rx))
  {
  cout<<"false"<<endl;
  }
  else
  cout<<"true"<<endl;
  return(0);
 20 }
Và khi compile mình có lỗi sau:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../include/c++/4.5.1/regex:35:0,
                 from reg.cpp:3:
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
reg.cpp:5:22: error: ‘tr1’ is not a namespace-name
reg.cpp:5:25: error: expected namespace-name before ‘;’ token
reg.cpp: In function ‘int main()’:
reg.cpp:11:6: error: ‘std::tr1’ has not been declared
reg.cpp:11:17: error: expected ‘;’ before ‘rx’
reg.cpp:13:40: error: ‘rx’ was not declared in this scope
reg.cpp:13:42: error: ‘regex_match’ was not declared in this scope
Mình có kiểm tra trong mục usr/include/c++/4.4.7/ và có file regex, mọi người biết cách khắc phục lỗi này không, mình cảm ơn.
 
      
    

 83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?
    83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?