-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to resolve " undefined reference to `std::__throw_bad_cast()'" #1111
Comments
As Can you compile and execute the test suite? |
This seems to be an issue with the compiler. Maybe related: |
Thank you. It seems to be an issue by c++ compiler config / flags. |
You mean |
I've already tried , but std::__throw_bad_cast() errors still occur. |
According to esp8266/Arduino#3358 the problem could be the usage of string streams. They are used in three locations in the code - each only in case of an error. You could try to change these locations by replacing |
@TridentTD Could you check the most recent |
Then I have no idea how to proceed. |
Do you mind to use Arduino's String (WString.h/ WString.cpp) Thank you. |
@TridentTD You can template the string type for the JSON library yourself. |
@TridentTD Do you need any further assistance? |
@nlohmann But my knowledge about C++ template is very little, and about std::string or std::__throw_bad_cast() too, |
On an embedded platform where there is no standard library and no standard crt0 you need to provide your own implemention of basic "system" functions. That's why it is a link error and not a compile error. Arduino's libraries should provide it but it seems they don't. Just put a function like this in your application: namespace std {
void __throw_bad_cast(void)
{
// print error and stop execution
}
} // namespace std Not sure about the prototype though. |
@TridentTD Any news on this? |
@TridentTD Does esp8266/Arduino#3358 (comment) work for you? |
@TridentTD Any news on this? |
I can compile well on ESP8266's xtensa_gcc compiler version5.1.0,
however when I want to receive string by dump() function .
It occurs some errors. How to resolve it?
First I try this code
The result can print well on Serial Monitor --> 3.141
However when I want to dump like the following.
It occurs error like this
How to resolve "undefined reference to `std::__throw_bad_cast()' " error ?
Thank you.
The text was updated successfully, but these errors were encountered: