Hey guys,

I'm wondering if anyone else is experiencing linking errors when it comes to building the ArduPilot source when you include fstream & sstream. Using the std::sstream, I get the error:

I researched the issue for a few hours and tried to find out what causes the linking error,  however there is no luck in this. The code is located in a standard ArduCopter .cpp. It falls under the ArduCotper branch. I did notice that in all of the ArduCopter code, no stream libraries where used. But if I look into the PX4-Firmware source, they do use stream libraries. I also noticed the the gcc-arm compiler that PX4 uses is 5.4+ while ArduPilot uses gcc-arm 4.9.3. To me it seems like a linking error between an older gcc compiler and c11++ standard libraries that would allow fstream and sstream usage. Does anyone else have this issue? Furthermore, if I simply decide to just include iostream (and not use it), I get the error:

ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build//home/helikido/ardupilot/module.pre.o: In function `__static_initialization_and_destruction_0':
/opt/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include/c++/4.9.3/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/opt/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include/c++/4.9.3/iostream:74: undefined reference to `std::ios_base::Init::~Init()'

So I'm at a loss...this has to be an outdated compiler issue, correct? Usually when you use gcc on linux to compile C11++ code, you have to use the -libstd++ command to link the c11++ libraries. However with ardupilot, I'm not sure on how to tell the gcc-arm compiler to link the standard libraries that will allow me to use fstream and sstream. The code compiles just fine, but it doesn't link correctly unfortunately. I'm using fstream and sstream to parse data from a sensor and store it into different variables. It works just fine when compiling with linux. Thank you for your help.

Views: 142

Reply to This

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service