2024-12-02 06:13 AM
Hi,
How to tell CubeIDE to compile specific *.c files with C++ compiler ?
Changing suffix from *.c to *.cpp is not an option.
Thank you
2024-12-02 06:24 AM
@ferro wrote:Changing suffix from *.c to *.cpp is not an option.
Why not? Seems misleading to name it .c when it's actually C++ ?
Anyhow, Could you just #include the .c file in a .cpp file, and exclude the .c file from build?
2024-12-02 06:32 AM
Thanks for prompt reply.
No, files are writen in C and want to compile with C++ compiler.
"Could you just #include the .c file in a .cpp file, and exclude the .c file from build?"
Good idea but I perefere to set it as a flag in project properties. In Keil uVision IDE you right click on a file and set the option to build it as C or C++.
2024-12-02 06:39 AM
If you right-click the file and choose 'Properties', there's this:
Looks like generic Eclipse ?
2024-12-02 07:15 AM
"If you right-click the file and choose 'Properties', there's this:"
Thanks. I set C++ there but adc.c is still treated as C.
Hm, Maybe clue is in what is writen at the bottom - seems that it is not per file.
If you can be bothered, could you try on your side, please ?