Why do I get an "undefined reference to 'abort'" linker error when building a C++ application?
The C++ library calls the function abort on errors such as being unable to allocate memory when calling the new operator.
This function is not included in the C++ library allowing you to handle the error in your application as you see fit, you therefore need to implement this function yourself in your application.
The following code demonstrates a very simple abort handler implementation:
extern "C" void abort(void)
{
while (1);
}
Comments
0 comments
Please sign in to leave a comment.