Hello @dagar
Thanks for your advice.
I’ve done what you said, and there are still some problems.
First, I’ve built a standalone project using Cmake to link it with fuzzylite, the CMakeLists are below
and the program has run well.
Second, I’ve added the CMake configuration and definition to Firmware/CMakeLists.txt and (the library that I’ve created in PX4 firmware) Firmware/src/lib/fuzzylb/CMakeLists.txt. I’ve also registered for the library in cmake/configs/posix_sitl_default.cmake. I provide the details in the picture below
And that generated the error [‘-std=c++11’ is valid for C++/ObjC++ but not for C [-Werror]].
Third, I’ve removed the line add_definitions(-std=c++11) from Firmware/CMakeLists.txt, and that generated the error [exception handling disabled, use -fexceptions to enable]
I started to think that fuzzylite contains some functions or prototypes which can’t be compiled in C or can’t be compiled without the definition -std=c++11 (or above).
Lastly, I’ve added the line add_definitions(-fexceptions) to FIrmware/CMakeLists.txt, it solved the problem about exception handling, but generated another problem about dynamic_cast, here are the detailed pictures.
Where dynamic_cast is located
So I’d like to ask 3 things:
1/ How to make PX4 CMakeLists compile something purely in C++.
2/ How to add some equivalent definitions to -std=c++11 in order to make the code of fuzzylite compilable.
3/ If changing CMakeLists is not able to solve these problems, do I have to change all fuzzylite source codes into C?
Thank you for your time and attention.