Add C++ toolchain to a C project?

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup only the latter as far as I know.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks.  I was hoping for some magic.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

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:

 

 

 

Last Edited: Tue. Apr 30, 2019 - 11:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wish there was a way, as this would make adding C++ code to an Atmel Start project way easier.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

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!

Last Edited: Tue. Apr 30, 2019 - 02:59 PM