How do I change the avr32-gcc C compiler for the C++ in Atmel Studio 6 without having to create a new project?

StackOverflow https://stackoverflow.com/questions/19241392

  •  30-06-2022
  •  | 
  •  

Question

I have been migrating an IAR project to Atmel Studio 6. It took me some time to create all the folders and getting the right structure as it is in the IAR project. Then I realized that I created a C project when actually I have C++ code too. So the question is: How do I change the GCC compiler from C to C++ without having to create a new project?

I can not find any proper documentation about Atmel Studio 6. I addition, I don't see a way to change this parameter from the GUI.

I found out that I don't have to change the C for the C++ compiler. I have to use both. Each compiler does its job. avr32-gcc compiles C code and avr32-gcccpp compiles C++ code. Now the question is: How do I add a second compiler to the project?

I already have the avr32-gcc for C.

Was it helpful?

Solution

For those interested in the solution here is how to do it:

Open you project in Atmel Studio 6 Go to the solution explorer and right click on the project. Select "Unload project" Now the project should be colored in gray. Right click again on the project and select Edit.

You will see the xml code from the configuration and settings of the project.

Around line 50 more o less you will find these lines:

<Language>C</Language>
<ToolchainName>com.Atmel.AVRGCC32.C</ToolchainName>

And modify them as follow, changing the language:

<Language>CPP</Language>
<ToolchainName>com.Atmel.AVRGCC32.CPP</ToolchainName>

Right click on the project again and select reload project.

Now if you go to the properties of the project (CTRL + F7) you will see two compilers in the Toolchain. Now you can compile both C and C++ code.

OTHER TIPS

In addition to the accepted answer (which was super helpful, by the way), make sure that all properties for the project are the same as they were previously. After making the suggested change, most properties for the Linker, Assembler, Preprocessing Assembler, and Archiver that existed prior to the change no longer existed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top