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 Newbie question on installing math.h library (Read 3356 times)
buzz
Newbies
*
Offline


Posts: 5
Joined: Aug 3rd, 2020
Newbie question on installing math.h library
Aug 3rd, 2020 at 10:17am
Print Post  
I have been programming off and on for 30 years and need a little assistance. I am trying to use math.h with a Nano and while I have found the AVR-libc website, referred to by Arduino.cc and unzipped the biz/tar file, I have not yet been successful in getting it to work with VM. I can see a few .h file but I can see no .CPP files. I'm wondering if I have to some other form of install on the library before I can link to it.
I did do a search through your archives but could see nothing on intalling this particular library. (I have had no issues with the standard IDE ones)
kind regards
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Newbie question on installing math.h library
Reply #1 - Aug 3rd, 2020 at 12:26pm
Print Post  
Hi

Did you try to simply add #include <math.h> to your code?

Visual Micro should work the same as the Arduino IDE, if you can see or use the library in the Arduino IDE then you should be able to automatically do the same in Visual Micro.

The math.h is part of the Arduino core for Nano, Uno, Mega boards and can simply be #included. 

If I missing the point then please explain. There are a lof of potential questions about your configuration. The information requested in yellow above should answer them thanks.

Thanks

Advanced: Finally, there are many ways to include external code. I am unclear at this time if you are an arduino newbie or a visual micro newbie. Visual Micro does support adding .a and .o files to the \libs folder of a project. This is outside of Arduino but allows the files to be linked and used. It is not a recommended solution but useful for advanced micrcontroller users.

« Last Edit: Aug 3rd, 2020 at 1:24pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
buzz
Newbies
*
Offline


Posts: 5
Joined: Aug 3rd, 2020
Re: Newbie question on installing math.h library
Reply #2 - Aug 3rd, 2020 at 2:31pm
Print Post  
Hi Tim - yes I started with #include <math.h> or <Math.h> without any luck. I'll try again, now the Arduino IDE compiled it ok.

I developed code for a number of years on CP/M, Forth engines and on Transputers with OCCAM. More recently I have programmed Arduinos and Windows in C# before but I'm a bit rusty and I have just never had to use extensive libraries. You can blame lockdown!
  
Back to top
 
IP Logged
 
buzz
Newbies
*
Offline


Posts: 5
Joined: Aug 3rd, 2020
Re: Newbie question on installing math.h library
Reply #3 - Aug 9th, 2020 at 11:39am
Print Post  
I did some checking - the Arduino IDE compiles a simple test sketch with <math.h> or <Math.h> and will do floating point calculations. It will even accept the maths functions without the #include statement.

Selecting the IDE option in VS/VM  and doing the same in a new VM project causes a similar test program to fail. It does not recognize the library or maths operation (with or without the #include statement). If I look at the library manager in VS/VM - math.h is not listed, but other built-in libraries are. It is a bit strange and reproducible across two different machines. All versions are up to date. I'm probably missing something obvious... just don't know what it is after trying all the obvious things!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Newbie question on installing math.h library
Reply #4 - Aug 9th, 2020 at 12:21pm
Print Post  
Please follow the guide in yellow above which will show us what you have configured.

Thanks
  
Back to top
WWW  
IP Logged
 
buzz
Newbies
*
Offline


Posts: 5
Joined: Aug 3rd, 2020
Re: Newbie question on installing math.h library
Reply #5 - Aug 9th, 2020 at 3:06pm
Print Post  
I think I found the source of my confusion -   

The compiler works and a simple program does trig and log functions.

I had assumed something was wrong as the intellisense in VS editor kept underlining the library include and function calls as an error. Can I make that go away?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Newbie question on installing math.h library
Reply #6 - Aug 9th, 2020 at 3:53pm
Print Post  
Great, if you follow the guide in yellow above that will show us what you have configured, which libs you are talking about, which core you are using and which versions.
  
Back to top
WWW  
IP Logged
 
buzz
Newbies
*
Offline


Posts: 5
Joined: Aug 3rd, 2020
Re: Newbie question on installing math.h library
Reply #7 - Aug 9th, 2020 at 5:18pm
Print Post  
Tim I fixed it. I had been using an installation of VS2017. I decided to un-install and install VS2019.  Intellisense is now working and math.h is now being picked up in external dependences.

regards
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint