Is there a way to tell an existing C project to add the C++ toolchain?
The only way I know is to start a new project and tell Studio it's a C++ project. That gives me both toolchains.
Yup only the latter as far as I know.
Thanks. I was hoping for some magic.
Well there would be a "back door" way because the solution/project files are just XML so if you create a C project and a C++/C project and then look at the additional bits in the C++ variant you could presumably graft something similar back into an existing C only one. But it's probably easier just to recreate from scratch.
EDIT: looked at that - a C++/C project has both <avrgcc.*> items and <avrgcccpp.*> items while C only has just <avrgcc.*>. I think adding <avrgcccpp.*> back into the C only could be "fraught" ! There's also things like <language>CPP</language> versus <language>C</language>
I do wonder why Atmel did it like this - why not make them all C/C++ and only use the C bits for a project that chooses to only use C? I suppose it's so that you don't get this section if it's not needed:
I wish there was a way, as this would make adding C++ code to an Atmel Start project way easier.
As an experiment you could simply try changing <language> and see if that triggers it - but presumably all the <avrgcccpp.*> entries that are not present will assume defaults?
EDIT: OK so not that simple...
EDIT2: OK so I changed <language> and <toolchain> (latter to add "PP" on the end of "C") and now at least I can see the C and C++ properties and the project APPEARS to build.
But hacking around XML by the backdoor is no guarantee that something vital has not been missed
So this solution could have some nasty things lurking!
© 2021 Microchip Technology Inc.