[ https://issues.apache.org/jira/browse/STDCXX-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534094 ]
Farid Zaripov commented on STDCXX-338: -------------------------------------- I have updated gcc up to 4.2.0 version and got the same linked error while building the examples and tests, but with multiple definitions of the std::bad_cast::what(), std::bad_typeid::what(), std::bad_alloc::what(), std::bad_exception::what(). The possible solution is #undefine _RWSTD_NO_BAD_CAST_WHAT, _RWSTD_NO_TYPEID_CAST_WHAT, _RWSTD_NO_BAD_ALLOC_WHAT, _RWSTD_NO_BAD_EXCEPTION_WHAT for Cygwin, but I want to ask why we define the std::bad_xxx::dtor() in BAD_ALLOC_ASSIGNMENT.cpp? etc/src/BAD_ALLOC_ASSIGNMENT.cpp, line 123: ---------------- ... # else // if !defined (TEST_DTOR) ~bad_alloc () { } # if defined (TEST_COPY_CTOR) ... ---------------- When I've commented this definition, the examples and tests are built without miltiple definitions linker errors. > [Cygwin] linker errors due to multiple definition of `std::exception::what()' > ----------------------------------------------------------------------------- > > Key: STDCXX-338 > URL: https://issues.apache.org/jira/browse/STDCXX-338 > Project: C++ Standard Library > Issue Type: Bug > Components: Configuration > Affects Versions: 4.1.3 > Environment: Cygwin > Reporter: Mark Brown > Assignee: Martin Sebor > Fix For: 4.2 > > > When linking with stdcxx on Cygwin I get errors like: > /usr/lib/gcc/i686-pc-cygwin/3.4.4/libsupc++.a(eh_exception.o):(.text+0x80): > multiple definition of `std::exception::what() const' > The config.log file shows these errors for the EXCEPTION_WHAT test: > gcc -c -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow > -Wwrite-strings -Wno-long-long -Wcast-align -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG > -I. /build > /sebor/stdcxx-4.1.3/etc/config/src/EXCEPTION_WHAT.cpp > In file included from > /home/mbrown/stdcxx-4.1.3/etc/config/src/EXCEPTION_WHAT.cpp:10: > /home/mbrown/stdcxx-4.1.3/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp:83: > warning: `class std::exception' has virtual functions but non-virtual > destructor > /home/mbrown/stdcxx-4.1.3/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp:333: > warning: unused parameter 'rhs' > /home/mbrown/stdcxx-4.1.3/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp:388: > warning: unused parameter 'rhs' > gcc EXCEPTION_WHAT.o -lm -lsupc++ -o EXCEPTION_WHAT > /usr/lib/gcc/i686-pc-cygwin/3.4.4/libsupc++.a(eh_exception.o):(.text+0x0): > multiple definition of `std::exception::~exception()' > EXCEPTION_WHAT.o:/home/mbrown/stdcxx-4.1.3/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp:(.text$_ZNSt9exceptionD2Ev[std::exception::~exception()]+0x0): > first defined here > collect2: ld returned 1 exit status -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.