Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Following this guide, it says to include a library in the C++ Linker called m. What is this for?

Specifically, Your second Arduino project.

4) Configure project

5th dot point:

AVR C++ Linker -> Libraries: Under libraries, add arduino_core and m (in that order). Under path, add the path to the correct core library, e.g. "${workspace_loc:/arduino_core/328P_16MHz}"

share|improve this question
    
Bewared of this tutorial that seems quite old and is probably not uptodate now. Note that if you want to use Eclipse, I'd suggest to take a look at this plugin: eclipse.baeyens.it I use it everyday (currently using 1.2.5.5 as I have not yet installed Arduino IDE 1.5). –  jfpoilpret Mar 31 at 16:34
    
@jfpoilpret Is that using the compiler shipped with the Arduino I DE? I actually decided not to use Arduino and go for full fledged C... –  Friend of Kim Apr 1 at 14:32
    
Yes it uses the AVR tools that come installed with Arduino IDE. But you can do full-fledged C or C++ with it if you want as it does not perform default #includes like Arduino IDE. –  jfpoilpret Apr 1 at 14:39
    
@jfpoilpret Do you have access to strings and vectors? –  Friend of Kim Apr 1 at 15:58
    
I haven't checked that but I'd rather stay away from STL and involved dynamic memory allocations for embedded development. –  jfpoilpret Apr 1 at 16:16

1 Answer 1

up vote 4 down vote accepted

The m library is the "math" library. You have to link with it in most flavours of gnu compilers (it is typically not required in other, as it is included in the standard lib) when using functions and stuff from the header file "math.h".

share|improve this answer
    
Is this a library that the compiler knows where is by itself? –  Friend of Kim Mar 31 at 16:21
    
Yes, it is enough to indicate "-lm" as an option to the compiler-linker. No necessity to indicate -L(pathToLib). –  drodri Mar 31 at 16:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.