SOLVED:stumped on Studio 5 erroring class; was OK in AS4

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

The error is
Error 1 expected '=', ',', ';', 'asm' or '__attribute__' before 'avrSPI' pathnamehere

the code (taken from my studio 4 version)

#ifndef SPI_H
#define SPI_H

#include 

class avrSPI	{

public:
	void 		init(void);
	uint16_t 	writeByte(unsigned char);

protected:

};

#endif

same error for two other .h class files.
But some other .h's (and their .cpp's) in my project that have the same structure compile without apparent error.
Again, this is studio 4 code simply copied to a new folder for use with studio 5.

Stumped.

Last Edited: Sun. Mar 18, 2012 - 06:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Me again... After several hours.. the C++ code from Studio 4 is now compiling w/Studio 5.1.
Regarding the problem, above, the scientific solution was: Try A, B, C, start over with new project via the wizard, several times, try D, E, F at random, and finally it compiled without error (as it did w/Studio 4).

Other than this big frustration, I am pleasantly surprised with the new Studio. Much better IDE and editor, with symbol-name jumps, etc. Smart move, Atmel, in tagging into Visual Studio. BUT, be sure to keep GCC for AVRs alive and well.

The project creation wizard has a subtle thing in the user interface... In the choices of project type, executable v.s. library, the 3rd choice is C++. The first choice says C, not C++. But both say C/C++ in the right-most column. I don't know what criteria they use to tell GCC which mode to be in (to parse .h files containing C++ code).

I too am confused as to where to put
#define F_CPU xxx
since UART and delay and others rely on it.
It ought to be in the GUI. Here's one scheme (rather retro)..

Quote:
Project menu → MyFirstProject Properties (Alt+F7) → Toolchain → AVR/GNU C Compiler → Symbols → Add F_CPU=16000000UL to Defined Symbols.


I also just tried Studio 6 beta (mega328P target) - and it seems to be essentially identical to Studio 5 for AVR.

PS: My .hex code, serial-bootloader-downloaded via avrdude, runs as it should!

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

Quote:

Much better IDE and editor, with symbol-name jumps, etc. Smart move, Atmel, in tagging into Visual Studio.

Are you insinuating that such functionality is unique to Visual Studio? :roll:

Quote:
It ought to be in the GUI. Here's one scheme (rather retro).. [...]

Nevertheless, that is the way.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Quote:

same error for two other .h class files.

If the compiler doesn't know the word "class" then I'd suggest it is a C compiler not a C++ compiler that is being used. Was it using avr-g++ directly of avr-gcc with the "-x c++"? If neither of those it was compiling it as C not C++.

EDIT: I see you bumped this thread:

https://www.avrfreaks.net/index.p...

That would seem to suggest exactly the same.

The funny thing is that as far as I know AS4 always passed anything.cpp to the C++ compiler. Why couldn't AS5/6 simply inherit this behaviour?

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

JohanEkdahl wrote:
Quote:

Much better IDE and editor, with symbol-name jumps, etc. Smart move, Atmel, in tagging into Visual Studio.

Are you insinuating that such functionality is unique to Visual Studio? :roll:

Quote:
It ought to be in the GUI. Here's one scheme (rather retro).. [...]

Nevertheless, that is the way.
Not insinuating at all... just my opinion that MS Studio is very beneficial to user productivity and is far better than the IDE in Studio 4. It's better than IAR's IDE for edit/compile.

However, comma, I've not used Atmel's Studio 5/6 for interactive debugging using JTAG or newer... with IAR on ARMs, the flash breakpoints make debugging flash-resident code no more difficult than with a PC and breakpoints.

Good thing that Atmel is doing this all at no cost to customers. Related: At work, last week I had to shell out $800 for a T.I. compiler and blick-IDE, because GCC for the MSP340 doesn't support > 64KB code.