2024-12-02 06:13 AM - edited 2024-12-03 02:41 AM
Hi,
How to tell CubeIDE to compile specific *.c files with C++ compiler ?
Changing suffix from *.c to *.cpp is not an option.
[edit] Changing the suffix from *.c to *.cpp is the least preferred option.
Thank you
2024-12-03 12:58 AM
@ferro wrote:"Compiler options can be modified per file."
Where, how ?
As I showed earlier
2024-12-03 12:59 AM
As I said this does not work.
2024-12-03 01:18 AM - edited 2024-12-04 05:57 AM
Thanks,
Andrew Neil suggested the same : 1st is suboptimal and 2nd does not work as this setting is at project level not a file. [Edit] It is supposed to be per file but seems to not work as described
2024-12-03 09:50 AM - edited 2024-12-03 10:26 AM
2024-12-03 01:27 AM - edited 2024-12-03 01:31 AM
You can exclude the file from build and build it separately using a make file. You can run this command prior to building as an extra build step. Then add the o-file to the linker: https://community.st.com/t5/stm32-mcus-products/how-to-link-an-already-generated-object-file-in-existing-project/m-p/124589/highlight/true#M22428
2024-12-03 01:33 AM
Uf, this sounds scary. Seems the least annoying option is to change suffix to cpp, CubeIDE auto assign compiler based on that. And it's not possible to change it per file.
2024-12-03 01:37 AM
@ferro wrote:Uf, this sounds scary. Seems the least annoying option is to change suffix to cpp, CubeIDE auto assign compiler based on that. And it's not possible to change it per file.
Your first post said it was impossible to change the file extension. And now it suddenly is?
2024-12-03 01:42 AM
Yes.
2024-12-03 01:46 AM
Would rephrase it to "Changing suffix from *.c to *.cpp is the last option."
2024-12-03 02:02 AM
"Rightclick the file. Click properties. Click C/C++ General. Click Language mappings. Then select GNU C++ from the drop down menus."
Did you actually try this ? I did not get reply from Neil.
2024-12-03 04:07 AM
@ferro wrote:"Rightclick the file. Click properties. Click C/C++ General. Click Language mappings. Then select GNU C++ from the drop down menus."
Did you actually try this ? I did not get reply from Neil.
Did YOU try this? I don't have your project. Since it says it overwrites project wide settings I think it only overwrites project wide defaults for that file. It wouldn't make sense if it would overwrite settings for other files. What would be the point otherwise? I only tried to see if my project had such an option, but I'm not going to modify it.