V
V
VladX2012-05-09 14:04:13
linux
VladX, 2012-05-09 14:04:13

What is the reason for the strange behavior when trying to write to std::cerr, the code throws out std::bad_cast?

In general, I encountered a very strange error. There is such a file - logger.cpp . There is a DEBUG_PRINT_1 macro - common_definitions.hpp (although this is not important, because bad_cast is thrown out in other cases as well).

Everywhere in the code where it occurs:

DEBUG_PRINT_1("что-то");

exception std::bad_cast takes off.
The strangest thing is that this only happens on Mac OS X. I tried to compile clang and gcc of different versions, plus on different versions of Mac OS X 10.6.7 and 10.7.3 - the same everywhere. But on Ubuntu and Windows everything works fine.
What could it be? Bug in Mac OS X? And how to get around it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ixSci, 2012-05-09
@ixSci

1) Where is the log written? if to a file, then try to output to cout
2) Is it some kind of library or what? If so, are they compiled with an application with completely identical keys?

V
VladX, 2012-05-09
@VladX

As it turns out, this was a bug in libstdc++ (which comes with gcc-4.6). And clang also linked to it. The bug is related to using a custom locale (from boost). After replacing the library, the problem disappeared.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question