Mixed Code C/C++ - Printable Version +- EmBitz (https://www.embitz.org/forum) +-- Forum: IDE (https://www.embitz.org/forum/forum-1.html) +--- Forum: ARM GCC toolchain (https://www.embitz.org/forum/forum-4.html) +--- Thread: Mixed Code C/C++ (/thread-178.html) |
Mixed Code C/C++ - harry71 - 04-01-2024 Hello, I will use in my project the skeleton, which is created from ST Micros Cube MX, it is native C-code With a switch with Code: #ifdef __cplusplus I go on to programm in C++. The compile process seems to be good. But the linker mentioned during linking the object files problems like "unknown synthax". My thought are going in the direction, the compiler for C is the gcc, for C++ it is g++. Because of this, the linkersymbols are probably not matching. My question is, how can I use the g++-compiler within embitz always for the C-Code (without rename main.c to main.cpp)? Is this possible? Or is it a completely different reason behind? Maybe, I have not considered all points from here ( How to mix C and C++, C++ FAQ (isocpp.org)) But for now, I see no other solution. Thanks, Jan RE: Mixed Code C/C++ - embitz - 04-01-2024 Settings->Tools->Global compiler settings goto "Toolchain executables" RE: Mixed Code C/C++ - embitz - 04-01-2024 But be aware that type casting in g++ is different than with GCC. e.g. Code: switch( (settingsIndex_Tp)pppL) becomes Code: switch( reinterpret_cast<settingsIndex_Tp &>(pppL)) But the normal, preferable, way is what you already are doing. C files are C files and not Cpp files. |