This error is also new since the upgrade to a new PRO version. Whole code was compiled before... Was VisualMicro config file changed during the upgrade?
Seems most errors are related to C++ feature . Only one library gives errors.
This library was included through vMicro->add library-> User library
Also the include file was typed in the body of Avionics_slave.ino file and as I understand vMicro includes it even implicitly just as Arduino IDE does. Is it so?
Environment: Visual Studio 2015 Community edition, current visual micro, Windows 7 Ultimate x64 .
Most of the code is the template definition .h file while .cpp file is only a container:
// SPI_Anything.h
template <typename T> unsigned int SPI_writeAnything(const T& value)
{
const byte * p = (const byte*)&value;
unsigned int i;
for (i = 0; i < sizeof value; i++)
SPI.transfer(*p++);
return i;
} // end of SPI_writeAnything
template <typename T> unsigned int SPI_readAnything(T& value)
{
byte * p = (byte*)&value;
unsigned int i;
for (i = 0; i < sizeof value; i++)
*p++ = SPI.transfer(0);
return i;
} // end of SPI_readAnything
template <typename T> unsigned int SPI_readAnything_ISR(T& value)
{
byte * p = (byte*)&value;
unsigned int i;
*p++ = SPDR; // get first byte
for (i = 1; i < sizeof value; i++)
*p++ = SPI.transfer(0);
return i;
} // end of SPI_readAnything_ISR
.cpp file is only a container:
#include "SPI_Anything.h"
void SPI_AnythingClass::init()
{
}
SPI_AnythingClass SPI_Anything;
And here are error messages from compiler:
Error compiling libraries
SPI_Anything.cpp:5: In file included from
Build failed for project 'Avionics_slave'
SPI_Anything.h: In function unsigned int SPI_writeAnything(const T&)
SPI_Anything.h: 5:8: error: 'byte' does not name a type
const byte * p = (const byte*)&value
SPI_Anything.h: 8:3: error: 'SPI' was not declared in this scope
SPI.transfer(*p++)
SPI_Anything.h: 8:17: error: 'p' was not declared in this scope
SPI.transfer(*p++)
SPI_Anything.h: In function unsigned int SPI_readAnything(T&)
SPI_Anything.h: 14:2: error: 'byte' was not declared in this scope
byte * p = (byte*)&value
SPI_Anything.h: 14:9: error: 'p' was not declared in this scope
byte * p = (byte*)&value
SPI_Anything.h: 14:19: error: expected primary-expression before ')' token
byte * p = (byte*)&value
SPI_Anything.h: 17:10: error: 'SPI' was not declared in this scope
*p++ = SPI.transfer(0)
SPI_Anything.h: In function unsigned int SPI_readAnything_ISR(T&)
SPI_Anything.h: 24:2: error: 'byte' was not declared in this scope
byte * p = (byte*)&value
SPI_Anything.h: 24:9: error: 'p' was not declared in this scope
byte * p = (byte*)&value
SPI_Anything.h: 24:19: error: expected primary-expression before ')' token
byte * p = (byte*)&value
SPI_Anything.h: 26:9: error: 'SPDR' was not declared in this scope
*p++ = SPDR; \\ get first byte
SPI_Anything.h: 28:10: error: 'SPI' was not declared in this scope
*p++ = SPI.transfer(0)
SPI_Anything.cpp: At global scope
SPI_Anything.cpp: 7:6: error: 'SPI_AnythingClass' has not been declared
void SPI_AnythingClass*: init()
SPI_Anything.cpp: 14:1: error: 'SPI_AnythingClass' does not name a type
SPI_AnythingClass SPI_Anything
Also error message saying that "byte" "does not name a type" is confusing ... When I was running it in older free version, all types were defined implicitly as .ino includes all the standard Arduino definitions...
Please help,
Sincerely
Vlad