Dear all,
I tested -flto on a pretty large program today, and it fails with a
multiple definition error:
./release\scenehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD0Ev[_ZThn16_N12BufferStreamD0Ev]+0x0):
multiple definition of `BufferStream::~BufferStream()'
./release\consolehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD0Ev[_ZTv0_n24_N12BufferStreamD0Ev]+0x0):
first defined here
./release\scenehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD0Ev[_ZThn16_N12BufferStreamD0Ev]+0x0):
multiple definition of `non-virtual thunk to BufferStream::~BufferStream()'
./release\consolehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD0Ev[_ZTv0_n24_N12BufferStreamD0Ev]+0x0):
first defined here
./release\scenehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD0Ev[_ZThn16_N12BufferStreamD0Ev]+0x0):
multiple definition of `virtual thunk to BufferStream::~BufferStream()'
./release\consolehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD0Ev[_ZTv0_n24_N12BufferStreamD0Ev]+0x0):
first defined here
./release\bufferstream.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD1Ev[_ZTv0_n24_N12BufferStreamD1Ev]+0x0):
multiple definition of `BufferStream::~BufferStream()'
./release\consolehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD1Ev[_ZThn16_N12BufferStreamD1Ev]+0x0):
first defined here
./release\bufferstream.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD1Ev[_ZTv0_n24_N12BufferStreamD1Ev]+0x0):
multiple definition of `virtual thunk to BufferStream::~BufferStream()'
./release\consolehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD1Ev[_ZThn16_N12BufferStreamD1Ev]+0x0):
first defined here
./release\bufferstream.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD1Ev[_ZTv0_n24_N12BufferStreamD1Ev]+0x0):
multiple definition of `non-virtual thunk to BufferStream::~BufferStream()'
./release\consolehandler.o (symbol from
plugin):(.gnu.linkonce.t._ZN12BufferStreamD1Ev[_ZThn16_N12BufferStreamD1Ev]+0x0):
first defined here
I have found this bug
<https://sourceware.org/bugzilla/show_bug.cgi?id=12762>, but it was not
followed-up since 2013 and gcc 4.6/4.7
Is this a bug or a problem in my code? The class BufferStream is defined
only once in a header file, and uses a default destructor. It is detailed
below.
Thanks,
Etienne
class BufferStream : public std::iostream
{
public:
BufferStream();
std::streampos size() const { return streamBuf.size(); }
const char * data() const { return streamBuf.data(); }
std::vector<char> getBufferAndClear() { return
streamBuf.getBufferAndClear(); }
private:
class StreamBuf : public std::streambuf
{
public:
explicit StreamBuf();
~StreamBuf() { }
int overflow(int c = EOF);
std::streampos size() const { return pptr()-pbase(); }
const char * data() const { return pbase(); }
std::vector<char> getBufferAndClear();
private:
std::vector<char> buffer;
};
StreamBuf streamBuf;
};
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public