This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using C++ standard libraries

I am using C++ to program the nRF52 DK and I am trying to use the standard vector library.

When I try and compile it I get the linker error: ${GCC_PATH}/arm-none-eabi/include/c++/6.3.1/ext/new_allocator.h:104: undefined reference to `operator new(unsigned int)'

I have been trying to alter the makefile for a couple of hours and haven't had any success in getting the linker to recognise the missing libraries. Is it possible to include the c++ standard libraries?

Parents
  • I am using GCC as my compiler, although my understanding is that it will automatically use the g++ compiler when working with a cpp file? (For reference, I have other .cpp files which are compiling fine, just can't use stdc++).

    I tried passing the following:

    CPPFLAGS += -I/${GCC_PATH}/arm-none-eabi/include LDFLAGS += -L/${GCC_PATH}/arm-none-eabi/lib LDLIBS += -lstdc++

    But this ending up giving a massive amount of errors, so I figured it was the wrong direction.

    Thanks for your help.

Reply
  • I am using GCC as my compiler, although my understanding is that it will automatically use the g++ compiler when working with a cpp file? (For reference, I have other .cpp files which are compiling fine, just can't use stdc++).

    I tried passing the following:

    CPPFLAGS += -I/${GCC_PATH}/arm-none-eabi/include LDFLAGS += -L/${GCC_PATH}/arm-none-eabi/lib LDLIBS += -lstdc++

    But this ending up giving a massive amount of errors, so I figured it was the wrong direction.

    Thanks for your help.

Children
No Data
Related