Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GCC C++11 support for <regex>

2,416 views
Skip to first unread message

Mark

unread,
May 12, 2012, 2:38:09 AM5/12/12
to
Hi,

I looked at the status page:
http://gcc.gnu.org/gcc-4.7/cxx0x_status.html
and it doesn't mention support for <regex> one way or the other.

I wrote this tiny test program:
////////////////////////////////////////////////////////////
#include <iostream>
#include <regex>

int main()
{
std::string s("ABC def");
std::regex rx("de");
std::cout << std::regex_match(s, rx) << " "
<< std::regex_search(s, rx) << std::endl;
return 0;
}
////////////////////////////////////////////////////////////
Expected output: 0 1
Actual output: 0 0

I built it like this (using my local g++ 4.7 build):

/home/mark/opt/gcc47/bin/g++ -o main.o -c -std=c++11 -pedantic -Wall -
Wextra -lstdc++ -lpthread -L/home/mark/opt/gcc47/lib -L/home/mark/opt/
gcc47/lib64 -ggdb main.cpp
export PATH=/home/mark/opt/gcc47/bin:/usr/bin
export LD_RUN_PATH=/home/mark/opt/gcc47/lib64
/home/mark/opt/gcc47/bin/g++ -o regex_test main.o -std=c++11 -pedantic
-Wall -Wextra -lstdc++ -lpthread -L/home/mark/opt/gcc47/lib -L/home/
mark/opt/gcc47/lib64

There were no warnings or errors and it compiled and ran.

Can anyone tell me what I've done wrong?
Is there some other library I should be linking against?

Thanks!

Mark

unread,
May 12, 2012, 2:55:05 AM5/12/12
to
On May 12, 7:38 am, Mark <l...@qtrac.plus.com> wrote:
> Hi,
>
> I looked at the status page:http://gcc.gnu.org/gcc-4.7/cxx0x_status.html
> and it doesn't mention support for <regex> one way or the other.
[snip]

I looked at the wrong status page. I should have looked at:
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html
This clearly shows that regex is not yet supported.
0 new messages