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 unusual vsarduino.h issue (Read 1672 times)
John Fitter
Junior Member
**
Offline


Posts: 26
Location: Australia
Joined: Mar 2nd, 2013
unusual vsarduino.h issue
Sep 29th, 2019 at 1:09pm
Print Post  
Using VS2015 and Arduino 1.6/1.8
vsarduino.h defines F_CPU and GCC_VERSION and both of these are recognized by Intellisense, both in the code window and in solution explorer. The compiler however only recognizes F_CPU. Any reference to GCC_VERSION throws a compiler error (this is just dummy code for testing)
Code
Select All
TBWFW.ino: 210:29: error: 'GCC_VERSION' was not declared in this scope
   GCC_VERSION \ 10000, (F_CPU % 10000) \ 100, F_CPU % 100) 


Curious - does anyone have any idea why?
Also, forward slashes were converted to back slashes in the error message - why???
I am not new to this but this one has me stumped....
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: unusual vsarduino.h issue
Reply #1 - Sep 29th, 2019 at 1:29pm
Print Post  
the vsarduino file is to bump start the Visual Studio C++ intellisense for Arduino which does not know about the GCC compiler tool that will be used.

The compliation uses the real tool chain which is resonposible to setting many internal #defines.

It is possible to obtain an accurate list of defines for intellisense but that requires running a tool chain. exe in background which is quite slow. So we plan to save the info after each build and use that instead of forcing generic defines. That will bring othe issues because the Vc++ intellisense does not like GCC. Therefore we also need to switch to a new intellisense engine that MS are working on.

So for now there is not a perfect correlation between intellisense and real tool chains especially when working with non-arduino lower level syntax.
  
Back to top
WWW  
IP Logged
 
John Fitter
Junior Member
**
Offline


Posts: 26
Location: Australia
Joined: Mar 2nd, 2013
Re: unusual vsarduino.h issue
Reply #2 - Sep 29th, 2019 at 2:37pm
Print Post  
Solved - sort of.
__GNUC__ etc. are defined for GCC and these are used to define GCC_VERSION, but no matter how hard I try I cannot find any instance of a definition of GCC_VERSION.
I can define it myself in terms of __GNUC__ etc. and everything works.
GCC_VERSION is defined in vsarduino.h but this is only to make Intellisense happy.
Big waste of time. Now back to real work....
  
Back to top
 
IP Logged
 
John Fitter
Junior Member
**
Offline


Posts: 26
Location: Australia
Joined: Mar 2nd, 2013
Re: unusual vsarduino.h issue
Reply #3 - Sep 29th, 2019 at 2:41pm
Print Post  
Thanks for your reply. You are right - Intellisense does not like GCC too much.
btw Intellisense does not like __GNUC__ etc. either, so I had to add them to vs-intellisense-fix.h
At least now nothing is complaining.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: unusual vsarduino.h issue
Reply #4 - Sep 29th, 2019 at 2:55pm
Print Post  
This is useful it is a difficult area that changes for the different hardware

I would be useful to know what hardware (board/platform) you are using and what you removed or changed from the standard vsarduino.h

Thanks very much

  
Back to top
WWW  
IP Logged
 
John Fitter
Junior Member
**
Offline


Posts: 26
Location: Australia
Joined: Mar 2nd, 2013
Re: unusual vsarduino.h issue
Reply #5 - Sep 29th, 2019 at 3:36pm
Print Post  
Tim@Visual Micro wrote on Sep 29th, 2019 at 2:55pm:
This is useful it is a difficult area that changes for the different hardware

I would be useful to know what hardware (board/platform) you are using and what you removed or changed from the standard vsarduino.h

Thanks very much


I am using my own design board with an Atmega169PA and Optiboot bootloader.
I did not alter vsarduino.h but here is my vs-intellisense-fix.h
Code (C++)
Select All
#if defined(_VMICRO_INTELLISENSE)
#define pgm_read_byte_near(address_short) uint8_t()
#define __GNUC__             5
#define __GNUC_MINOR__       4
#define __GNUC_PATCHLEVEL__  0
#endif 


This keeps Intellisense happy.

In my program I just use the predefined macros and they just work, eg.
Code (C++)
Select All
ConsoleMsg(INFO,  PSTR("Compiled:   " __DATE__ " at " __TIME__ ", GCC v%d.%d.%d"), __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
 



I also tried defining the following and it worked fine too;
Code (C++)
Select All
#define GCC_VERSION ((__GNUC__*10000)+(__GNUC_MINOR__*100)+__GNUC_PATCHLEVEL__)) 


but as I wrote in the earlier post I could not find this definition anywhere in my GCC installation, so I had to define it myself. If it is not defined anywhere then it probably does not belong in vsarduino.h

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: unusual vsarduino.h issue
Reply #6 - Sep 30th, 2019 at 12:34pm
Print Post  
Thanks, we will update the defs. The vsarduino.h has the same purpose as intellisense-fix.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint