public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* <regex> doesn't work with g++
@ 2012-07-26 21:46 Daniel Colascione
  2012-07-27  3:03 ` Yaakov (Cygwin/X)
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Colascione @ 2012-07-26 21:46 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1815 bytes --]

/tmp
$ cat foo.cpp
#include <stdio.h>
#include <regex>

int
main()
{
    std::regex e("hello");
}

$ g++ -std=gnu++0x foo.cpp
/tmp/ccS3vCW7.o:foo.cpp:(.text$_ZNSt11basic_regexIcSt12regex_traitsIcEEC1EPKcj[std::basic_regex<char,
std::regex_traits<char> >::basic_regex(char const*, unsigned
int)]+0x60): undefined reference to `std::basic_regex<char,
std::regex_traits<char> >::_M_compile()'
collect2: ld returned 1 exit status

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.5.3/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with:
/gnu/gcc/releases/respins/4.5.3-3/gcc4-4.5.3-3/src/gcc-4.5.3/configure
--srcdir=/gnu/gcc/releases/respins/4.5.3-3/gcc4-4.5.3-3/src/gcc-4.5.3
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/gcc4
-C --datadir=/usr/share --infodir=/usr/share/info
--mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr
--enable-bootstrap --enable-version-specific-runtime-libs
--libexecdir=/usr/lib --enable-static --enable-shared
--enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld
--with-gnu-as --with-dwarf2 --disable-sjlj-exceptions
--enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++
--enable-graphite --enable-lto --enable-java-awt=gtk --disable-symvers
--enable-libjava --program-suffix=-4 --enable-libgomp --enable-libssp
--enable-libada --enable-threads=posix --with-arch=i686
--with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4
CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake
GNATBIND_FOR_TARGET=gnatbind --with-ecj-jar=/usr/share/java/ecj.jar
Thread model: posix
gcc version 4.5.3 (GCC)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: <regex> doesn't work with g++
  2012-07-26 21:46 <regex> doesn't work with g++ Daniel Colascione
@ 2012-07-27  3:03 ` Yaakov (Cygwin/X)
  2012-07-27  3:26   ` Daniel Colascione
  0 siblings, 1 reply; 4+ messages in thread
From: Yaakov (Cygwin/X) @ 2012-07-27  3:03 UTC (permalink / raw)
  To: cygwin

On 2012-07-26 16:46, Daniel Colascione wrote:
> $ g++ -std=gnu++0x foo.cpp
> /tmp/ccS3vCW7.o:foo.cpp:(.text$_ZNSt11basic_regexIcSt12regex_traitsIcEEC1EPKcj[std::basic_regex<char,
> std::regex_traits<char> >::basic_regex(char const*, unsigned
> int)]+0x60): undefined reference to `std::basic_regex<char,
> std::regex_traits<char> >::_M_compile()'
> collect2: ld returned 1 exit status

GCC 4.5 does not have full support for C++0x.  We'll need an upgrade to 
4.7 for this to work.


Yaakov



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: <regex> doesn't work with g++
  2012-07-27  3:03 ` Yaakov (Cygwin/X)
@ 2012-07-27  3:26   ` Daniel Colascione
  2012-07-27  8:37     ` Zouzou
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Colascione @ 2012-07-27  3:26 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 870 bytes --]

On 7/26/2012 8:03 PM, Yaakov (Cygwin/X) wrote:
> On 2012-07-26 16:46, Daniel Colascione wrote:
>> $ g++ -std=gnu++0x foo.cpp
>> /tmp/ccS3vCW7.o:foo.cpp:(.text$_ZNSt11basic_regexIcSt12regex_traitsIcEEC1EPKcj[std::basic_regex<char,
>>
>> std::regex_traits<char> >::basic_regex(char const*, unsigned
>> int)]+0x60): undefined reference to `std::basic_regex<char,
>> std::regex_traits<char> >::_M_compile()'
>> collect2: ld returned 1 exit status
> 
> GCC 4.5 does not have full support for C++0x.  We'll need an upgrade to
> 4.7 for this to work.

That's surprising. The regex header was in TR1, from back in 2005. I'd
have expected gcc to support it a long time ago. I'm also surprised to
see that the header definition present and the libstdc++ implementation
absent. That's what made me think there was something wrong with the
toolchain.

Thanks.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: <regex> doesn't work with g++
  2012-07-27  3:26   ` Daniel Colascione
@ 2012-07-27  8:37     ` Zouzou
  0 siblings, 0 replies; 4+ messages in thread
From: Zouzou @ 2012-07-27  8:37 UTC (permalink / raw)
  To: cygwin

On 27/07/12 5:26, Daniel Colascione wrote:
> On 7/26/2012 8:03 PM, Yaakov (Cygwin/X) wrote:
>> On 2012-07-26 16:46, Daniel Colascione wrote:
>>> $ g++ -std=gnu++0x foo.cpp
>>> /tmp/ccS3vCW7.o:foo.cpp:(.text$_ZNSt11basic_regexIcSt12regex_traitsIcEEC1EPKcj[std::basic_regex<char,
>>>
>>> std::regex_traits<char> >::basic_regex(char const*, unsigned
>>> int)]+0x60): undefined reference to `std::basic_regex<char,
>>> std::regex_traits<char> >::_M_compile()'
>>> collect2: ld returned 1 exit status
>>
>> GCC 4.5 does not have full support for C++0x.  We'll need an upgrade to
>> 4.7 for this to work.
>
> That's surprising. The regex header was in TR1, from back in 2005. I'd
> have expected gcc to support it a long time ago. I'm also surprised to
> see that the header definition present and the libstdc++ implementation
> absent. That's what made me think there was something wrong with the
> toolchain.
>
> Thanks.
>

std::regex is not fully implemented; upgrading to GCC 4.7 won't change 
anything. there are several todo notices in regex header files hinting 
at this.

have a look at boost::regex for the time being; should be close enough 
to std::regex.

Zouzou

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-27  8:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-26 21:46 <regex> doesn't work with g++ Daniel Colascione
2012-07-27  3:03 ` Yaakov (Cygwin/X)
2012-07-27  3:26   ` Daniel Colascione
2012-07-27  8:37     ` Zouzou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).