eclipse-threadx / threadx

Eclipse ThreadX is an advanced real-time operating system (RTOS) designed specifically for deeply embedded applications.
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx/index.md
MIT License
2.92k stars 797 forks source link

make threadx compiles with c++ compilers #408

Open rahmanih opened 1 month ago

rahmanih commented 1 month ago

Hi, When compiling threadx with g++ compilers, some errors are thrown. this request is about fixing all those errors.

PS: attached the error log when compilinga project using arm-none-g++.(not all files where compiled in this project). build_errors.txt

hwmaier commented 1 month ago

It appears you are using g++ to compile ThreadX code. ThreadX is written in C not C++, so try using gcc instead of g++.

In case you want to compile C++ code with ThreadX header files, set the compiler flag -fpermissive.

I tend to add the following line to my CMakefiles for mixed language (C/C++)projects:

add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>) # Allow passing const char * to char * in C++

I hope that helps to overcome your compilation issue.