Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Ringmeister
PostPosted: Mar 04, 2011 - 07:34 PM
Rookie


Joined: Jun 02, 2009
Posts: 27
Location: British Columbia, Canada.

Anyone managed to compile C++ code from Studio 5?

The only way I could find to do so was to rename avr-g++.exe to avr-gcc.exe in "C:\Program Files\Atmel\AVR Studio 5.0\extensions\Application\AVR Toolchain\bin"

Seems like a crappy solution but does work. The other issue is the Studio 5 IDE doesn't by default recognise .CPP files as source files.

Ian.
 
 View user's profile Send private message  
Reply with quote Back to top
atomicdog
PostPosted: Mar 04, 2011 - 09:12 PM
Posting Freak


Joined: Jan 14, 2008
Posts: 1148
Location: San Diego

Instead, just add -x c++ to the command line.

_________________
~~John
TWI C source code
 
 View user's profile Send private message  
Reply with quote Back to top
Ringmeister
PostPosted: Mar 04, 2011 - 09:39 PM
Rookie


Joined: Jun 02, 2009
Posts: 27
Location: British Columbia, Canada.

Thanks John, I gave it a go and it works fine Smile

I had tried the -x option without knowing the "c++" bit needed to be included. Doh! Stupid brain! Or maybe that should be "stupid documentation" Wink

Ian.
 
 View user's profile Send private message  
Reply with quote Back to top
mike32217
PostPosted: Mar 05, 2011 - 01:40 AM
Hangaround


Joined: Feb 28, 2010
Posts: 153
Location: Jacksonville, FL

John thanks for the tip, I noticed though that the files need to keep the .c extension if you change to .cpp it doesn't pick them up. i.e. Makefile does not contain an entry for the ones with .cpp extension.?

_________________
Mike
http://www.JaxCoder.com
WinHeist - Windows Electronic Inventory SysTem.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
atomicdog
PostPosted: Mar 05, 2011 - 01:53 AM
Posting Freak


Joined: Jan 14, 2008
Posts: 1148
Location: San Diego

mike32217 wrote:
John thanks for the tip, I noticed though that the files need to keep the .c extension if you change to .cpp it doesn't pick them up. i.e. Makefile does not contain an entry for the ones with .cpp extension.?
Yeah, I noticed the same thing and had to change my original files from .cpp/.hpp to .c/.h.

_________________
~~John
TWI C source code
 
 View user's profile Send private message  
Reply with quote Back to top
mike32217
PostPosted: Mar 05, 2011 - 02:09 AM
Hangaround


Joined: Feb 28, 2010
Posts: 153
Location: Jacksonville, FL

Well since it's Beta they still have a lot of work to do so maybe they will address that?
Since device memory is increasing exponentially you would think that C++ would be an option.

_________________
Mike
http://www.JaxCoder.com
WinHeist - Windows Electronic Inventory SysTem.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
atomicdog
PostPosted: Mar 05, 2011 - 03:22 AM
Posting Freak


Joined: Jan 14, 2008
Posts: 1148
Location: San Diego

mike32217 wrote:
Well since it's Beta they still have a lot of work to do so maybe they will address that?
Yeah it's a beta release, but it still seems a little suspect to me. One of the plus's for choosing to develop an IDE using VS is components like syntax highlighting/parsing are already done. So I wonder why they disabled it for c++.

_________________
~~John
TWI C source code
 
 View user's profile Send private message  
Reply with quote Back to top
mike32217
PostPosted: Mar 05, 2011 - 03:25 AM
Hangaround


Joined: Feb 28, 2010
Posts: 153
Location: Jacksonville, FL

Looks like we need another sticky "Things we want for the final release wish list". Smile

_________________
Mike
http://www.JaxCoder.com
WinHeist - Windows Electronic Inventory SysTem.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
spostma
PostPosted: Mar 13, 2011 - 08:28 AM
Newbie


Joined: Feb 08, 2011
Posts: 5


When using 32bit framework drivers, there are still a lot of issues when using -x c++. (I know this is the 8 bit section, but the 32bits section does not have a studio 5 forum)
The software framework is written in C, not C++. So when using -x c++ the compiler will not be able to distinguish between C and C++. You going to have to add a lot of extern "C" {} blocks. And for some statements you are going to get error messages like this:
invalid conversion from 'void*' to 'const volatile uint8_t*'
They can be resolved like this:
static_cast<const volatile uint8_t*>(value)

I also got an error in intc.c on this line:

// define _evba from exception.S
extern void _evba;

Things get from bad to worse when you include <string> and start using them.
So unless you are good at creating external make files, I recommend waiting for the final version of studio 5 if you are using C++.
What I did do in the end, is selecting all the drivers and services I need in studio 5, then I copied the entire asf directory (except avr32\utils\start) to my studio 2.7 and fixed all the includes.
 
 View user's profile Send private message  
Reply with quote Back to top
kalbun
PostPosted: Mar 18, 2011 - 06:14 PM
Hangaround


Joined: Mar 02, 2010
Posts: 103
Location: Firenze, Italy

spostma wrote:
When using 32bit framework drivers, there are still a lot of issues when using -x c++.


One year ago I worked on a C++ project for an UC3A using AVR32 Studio.
It was a real nightmare because, apart from the fact that framework is in C, the support for C++ was almost non-existent in the Studio.

So no wonder there are so many issues with version 5. Atmel seems to still ignore C++ as a programming language for MPUs, after all.
Sad
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
kalbun
PostPosted: Mar 23, 2011 - 01:14 PM
Hangaround


Joined: Mar 02, 2010
Posts: 103
Location: Firenze, Italy

Well, I've done some experiments with an existing XMega/C++ project.
Apart some tweaking in the configuration file and the need to change extensions from .cc to .c everything worked fine. Flash programming seems somewhat faster, and honestly I prefer this Visual Studio-like interface over Eclipse.
Too bad the integration with CVS that was present on Avr32 Studio is missing here Sad
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
mike32217
PostPosted: Mar 23, 2011 - 01:23 PM
Hangaround


Joined: Feb 28, 2010
Posts: 153
Location: Jacksonville, FL

Give it time someone will come up with it. Have you tried SVN? I've been using AnkhSVN extension for a couple of years now and it integrates with Visual Studio nicely.

_________________
Mike
http://www.JaxCoder.com
WinHeist - Windows Electronic Inventory SysTem.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
kalbun
PostPosted: Mar 23, 2011 - 04:07 PM
Hangaround


Joined: Mar 02, 2010
Posts: 103
Location: Firenze, Italy

Hey, thanks for the suggestion!
Yes, my provider allows me to create both CVS and SVN repositories. So I just installed Ankh from the tools->extension manager menu.
I'll need some time to get started with it, but my problem seems solved Smile
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits