Cannot compile code on Adafruit nRF52840 Express

Hardware:
Adafruit nRF528400 + Adafruit nRF528400 ethernet feather wing

Objective:
Using the BLE function to scan and control the peripheral devices (robots)

When I try to compile my code, I got the following error:

Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Feather nRF52840 Express, S140 6.1.1, Level 0 (Release), Serial"











Library Adafruit_nRFCrypto has been declared precompiled:
Using precompiled library in /Users/mac/Library/Arduino15/packages/adafruit/hardware/nrf52/1.2.0/libraries/Adafruit_nRFCrypto/src/cortex-m4/fpv4-sp-d16-hard
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Sp_counted_ptr_inplace<BLEClientService, std::allocator<BLEClientService>, (__gnu_cxx::_Lock_policy)0>::_M_get_deleter(std::type_info const&)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/shared_ptr_base.h:587: undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Sp_counted_ptr_inplace<IdInfo, std::allocator<IdInfo>, (__gnu_cxx::_Lock_policy)0>::_M_get_deleter(std::type_info const&)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/shared_ptr_base.h:587: undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Sp_counted_ptr_inplace<MotorControl, std::allocator<MotorControl>, (__gnu_cxx::_Lock_policy)0>::_M_get_deleter(std::type_info const&)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/shared_ptr_base.h:587: undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Sp_counted_ptr_inplace<BLEClientCharacteristic, std::allocator<BLEClientCharacteristic>, (__gnu_cxx::_Lock_policy)0>::_M_get_deleter(std::type_info const&)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/shared_ptr_base.h:587: undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Sp_counted_ptr_inplace<Cube, std::allocator<Cube>, (__gnu_cxx::_Lock_policy)0>::_M_get_deleter(std::type_info const&)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/shared_ptr_base.h:587: undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree_iterator<std::pair<String const, std::shared_ptr<Cube> > >::operator++()':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::map<String, std::shared_ptr<Cube>, std::less<String>, std::allocator<std::pair<String const, std::shared_ptr<Cube> > > >::at(String const&)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_map.h:539: undefined reference to `std::__throw_out_of_range(char const*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_map.h:539: undefined reference to `std::__throw_out_of_range(char const*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree_iterator<std::pair<String const, std::shared_ptr<Cube> > >::operator--()':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:302: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree<String, std::pair<String const, std::shared_ptr<Cube> >, std::_Select1st<std::pair<String const, std::shared_ptr<Cube> > >, std::less<String>, std::allocator<std::pair<String const, std::shared_ptr<Cube> > > >::_M_insert_node(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node<std::pair<String const, std::shared_ptr<Cube> > >*)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:2361: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::vector<String, std::allocator<String> >::_M_check_len(unsigned int, char const*) const':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1756: undefined reference to `std::__throw_length_error(char const*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree_iterator<std::pair<String const, std::shared_ptr<Cube> > >::operator++()':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree_const_iterator<std::pair<String const, std::shared_ptr<Cube> > >::operator++(int)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:374: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree<String, std::pair<String const, std::shared_ptr<Cube> >, std::_Select1st<std::pair<String const, std::shared_ptr<Cube> > >, std::less<String>, std::allocator<std::pair<String const, std::shared_ptr<Cube> > > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<String const, std::shared_ptr<Cube> > >)':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:2509: undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/bridge.ino.cpp.o: in function `std::_Rb_tree_iterator<std::pair<String const, std::shared_ptr<Cube> > >::operator++()':
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/mac/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/c++/9.2.1/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Adafruit Feather nRF52840 Express.


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I already install the necessary library packages and board (e.g. Adafruit nRF52 board, Adafruit SAMD, Arduino SAMD, etc). Can someone tells me what does this error mean and how to fix it? Really appreciate!

PS: Since I think feather wing is a supplemental component for the feather board, I try to upload my code to the feather board instead of the feather wing.

I'm not sure about the nRF52 board specifically, and I don't see your source code, but your sketch appears to use a lot of C++ STL functions that I don't think are included in the Arduino support. Some of these you might be able to add through the use of appropriate libraries, but I think some (assorted throw_... use of exceptions) are just unavailable in the primitive operating system environment of the deeply embedded processors.

(Though I'm surprised that you didn't see error messages at the compile level, long before you got to the linker.)

Are you trying to port C++ code from a PC or Single-board-computer (ie Raspberry Pi or Beaglebone) environment?

Thanks for the reply! The source code is https://github.com/Whatever-Inc/zorozoro-experiments/blob/main/13-unitycontroller2/Arduino/bridge/app.ino. I am trying to make this code running on my end.

The computer I use is Mac M1 Chip and the hardware I am using is nRF528400 feather + feather wing. The end goal is to use bluetooth to scan for peripheral robot and estalibsh the connection.

So what I am trying to do is to upload C++ code to feather board (the non-ethernet one). I hope this clarification makes sense.

Are there any way to integrate C++ standard library to arduino?

Corrected link: GitHub - Whatever-Co/zorozoro-experiments

That whole project seems to be based on platformIO and VSCode.
I'm afraid I have no idea about how to convert it to have pieces built by the Arduino IDE. :frowning: