-1

What are additional configurations required in compilations and linking to successfully compile the c++98 codes using C++11/gnu+11 standard?

Existing gcc version is g++ (GCC) 4.8.5 20150623 on RHEL7 OS.

In order to use C++11 standard on the existing code written in C++98, flag -std=c++11 was added along with -D_GLIBCXX_USE_CXX11_ABI=0.

While compiling existing code, the following error is still thrown:

undefined reference to `__cxa_throw_bad_array_new_length'
collect2: error: ld returned 1 exit status

Please, help on this issue.

sungtm
  • 547
  • 3
  • 12
  • 2
    Take a whack at [rephrasing your question](https://stackoverflow.com/posts/56765263/edit), stating precisely (a) what you're trying to do, (b) the toolchain and platform you're trying to do it on, (c) what you've tried so far, and (d) what results those efforts seemed to demonstrate. – WhozCraig Jun 26 '19 at 04:39
  • @WhozCraig, problem statement was updated. – sungtm Jun 26 '19 at 05:36
  • It's still a bit bad but I guess english isn't your first language. Show us the offending line of code, I'll help regardless of the soup nazis on this site. – 0xbaadf00d Jun 26 '19 at 05:40
  • 2
    Have you tried to google for __cxa_throw_bad_array_new_length? – n. m. could be an AI Jun 26 '19 at 05:42
  • I was about to suggest the same, just google that error code. The error is quite specific and should give you lots to work off of. – 0xbaadf00d Jun 26 '19 at 05:44
  • @0xbaadf00d, thanks for commenting on language syntax also for further improvement. – sungtm Jun 26 '19 at 06:03

1 Answers1

2

The post program linking fails when using custom built gcc helped me resolve the issue.

It was due to linking of the object file with different version of the system libraries.

sungtm
  • 547
  • 3
  • 12