Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Upgraded Visual Micro: new library compile errors (Read 4109 times)
birdman
Junior Member
**
Offline


Posts: 20
Joined: Sep 24th, 2016
Upgraded Visual Micro: new library compile errors
Feb 22nd, 2017 at 3:01am
Print Post  
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:

Code (C++)
Select All
// 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:

Code (C++)
Select All
#include "SPI_Anything.h"
void SPI_AnythingClass::init()
{
}
SPI_AnythingClass SPI_Anything;
 



And here are error messages from compiler:

Code (C++)
Select All
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
« Last Edit: Feb 22nd, 2017 at 12:44pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
birdman
Junior Member
**
Offline


Posts: 20
Joined: Sep 24th, 2016
Re: Upgraded to PRO: new library compile errors
Reply #1 - Feb 22nd, 2017 at 3:12am
Print Post  
Also seems to be a new feature I just noticed: when adding a library to a project, it is added outside of a project (attached to the root solution ) and a tip shows "pending add" ... I did not see this before... If relevant include file .h appears in the project folder right away, then  What does this "pending add" mean?
« Last Edit: Feb 22nd, 2017 at 3:19am by birdman »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upgraded to PRO: new library compile errors
Reply #2 - Feb 22nd, 2017 at 12:44pm
Print Post  
Hi, i think you are seeing some standard visual studio messages. pending add is not a visual micro message.

Please send screen shot because it's quite difficult to understand the report.

Also if reporting build problems please switch on vmicro>compiler> verbose and also "show build properties". then build and email the output as a .txt to info[at]visualmicro.com. Include a link to this post in the email.

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upgraded Visual Micro: new library compile errors
Reply #3 - Feb 22nd, 2017 at 10:07pm
Print Post  
Thanks for the output. Use Build>Rebuild for a clean build but it should not be required very often.

Remove invalid headers from code.
  
Back to top
IP Logged
 
birdman
Junior Member
**
Offline


Posts: 20
Joined: Sep 24th, 2016
Re: Upgraded Visual Micro: new library compile errors - SOLVED
Reply #4 - Feb 24th, 2017 at 12:08am
Print Post  
Tim, I found the source of the problem and I have to apologize.
Since the errors popped up only after upgrading the environment I "logically" assumed that problem is there. Wrong.
First of all my changing environment was not only vMicro - I also upgraded Arduino IDE from v1.6.11 to 1.8.1  which updated also a toolchain used by vMicro!!!
This last upgrade I think changed the behavior of the compiler. The library which produced errors indeed had problems which I never looked into because this library I downloaded from github and it's being working with my code for few months...
Now, after the upgrade to a new toolchain/compiler , compiler started being picky Smiley Today I looked into this library code - I got surprised: why the older compiler did not complain about this ? Roll Eyes
I deleted .cpp file in that library - it was no more than trashy space holder,
and leaving only .h file to be shared between projects. Everything compiles fine now.
Thank you for a wonderful tool. vMicro mated with VS is very powerful.
Sincerely
Vlad
« Last Edit: Feb 24th, 2017 at 12:10am by birdman »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint