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 math.h works for UNO but not Due (Read 4079 times)
brianduino
Newbies
*
Offline


Posts: 2
Joined: Feb 15th, 2016
math.h works for UNO but not Due
Feb 15th, 2016 at 12:35am
Print Post  
I have a program that uses atan2(y,x) function. When i select the UNO board it is all fine and recognized. When i select the Due, hovering over it show atan2() and says too many arguments.

I've included the math.h and the same sketch works flawless in Arduino IDE. Am using Visual Studio 2015 and latest Visual Micro, latest 1.6.6 version of Due board installed.

Any help would be appreciated as to why the atan2 function isn't being recognized on the Due, but is when the UNO board is slected.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: math.h works for UNO but not Due
Reply #1 - Feb 15th, 2016 at 9:04pm
Print Post  
Hi,

Thanks for the report.

Does the compile/upload fail? I ask because you mention the arduino ide which can only "compile/upload" and does not have any intellisense.

If an intellisense error there is some arduino syntax that visual studio doesn't understand or can't easily locate. We can usually modify visual micro slightly to cater for it. I will look into that.

In the meantime you can also patch the intellisense yourself if it annoys you by adding a .h to your project that contains "intellisense only" code (ignored during real compilation). 

I just added an intellisense.h to a project with the code below. The .h file can be called anything. 

The _MSC_VER constant is defined when editing code but not when compiling.

Code (C++)
Select All
#pragma once

#if _MSC_VER

//insert dummy defs here

extern double atan2(long, long);
double atan2(long y, long x) { return -1; }

#endif

 




tip: You might need to save the .ino or build for the new .h file is recognized my intellisense. You do not need to #include the file in your code.

« Last Edit: Feb 15th, 2016 at 9:30pm by Tim@Visual Micro »  
Back to top
IP Logged
 
brianduino
Newbies
*
Offline


Posts: 2
Joined: Feb 15th, 2016
Re: math.h works for UNO but not Due
Reply #2 - Feb 15th, 2016 at 10:57pm
Print Post  
Yes it does compile fine with the Due despite the intellisense error. Long time Visual Studio user so didn't even think of trying to compile while displaying an error. Good call!

Your solution works by adding extern definitions of functions, certainly workable.

Thank you for the prompt response. Smiley
  
Back to top
 
IP Logged
 
John Ewert
Newbies
*
Offline


Posts: 6
Location: Comox BC Canada
Joined: Nov 15th, 2012
Re: math.h works for UNO but not Due
Reply #3 - Mar 3rd, 2016 at 4:28am
Print Post  
I had same problem with Intellisense on Due board with strcat function, would compile upload and run correctly on all boards but give Intellisense too many arguments error on Due only. This fixed it. Thanks from me also.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint