math.h in SAMD project

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

So i would like to use the "roundf()"  function to round a float number.  So i used    #include "math.h"     to do so.  but the "roundf()" function is red underlined , like there is an issue. the function works fine though , the rounding seem to be working.

 

Is there specific way one needs to use math libs for SAMD projects ?

 

 

 

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

Should be #include <math.h>
I don’t know if that will change the ID Es behavior...

Last Edited: Wed. Oct 24, 2018 - 10:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nope , that didnt do it. i checked it with the debugger and it seems to do the right thing.   the strange thing is that is i use cos(x) instead of roundf(x) , i dont get anything red underlined.

 

Even when i look inside the math.h file , a lot of functions are red underlined.

 

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

So the red underscore comes from Tomato's Visual Assist extension (VAssistX on the main menu).  Turn off VA via "VAssistX->Enable/Disable Visual Assist" on the menu and the red underlines go away (I know, not a solution, just proof of where it's coming from).

 

I played with it a bit in a stub project and as best as I can tell it has to do with the way the functions are defined inside the toolchain's header file.  It looks like the include files are being parsed properly.  Right click on the #include <math.h> line in your project, select "Goto Implementation" and it properly jumps to the correct file.  Disable VA and try again, you get an error message saying "Please Make sure Visual Assix X Extension is installed and enabled".  Further proof that the paths are correct and VA is picking up the file for parsing.

 

Tomato has a paid version VA on their website.  They also have a support forum.  Perhaps post a thread in the support forum for guidance?

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

It is true what you say.

 

odd thing is that when i right click the   "math.h"  it takes me to the math.h file . but when i right click roundf() and select go to implementation , it doesnt go anywhere.

 

in the settings of the VA ,  under "underlining" , there is a check box underline unknown symbols. when i uncheck that the squiggles disappear .

 

wonder why the IDE can find math.h , can find the roundf() function , can compile it in the bit code , but can not find its implementation from the main.c file.