Questions tagged [libm]

Under Linux, the mathematical functions (as declared in math.h) are bundled separately in the mathematical library libm. If any of them is used, the linker must be given the directive -lm.

Taken from here.

72 questions
0
votes
1 answer

Getting following error "collect2: ld returned 1 exit status"

I have created a C source file using the modules from other source files. Suppose the created source file is abc.c .Mine C file compiles fine using the following command. gcc -c abc.c I have compiled each and every source file that are linked to…
thetna
  • 6,903
  • 26
  • 79
  • 113
0
votes
1 answer

How not to link with libm using Intel C Compiler

I want to compile some very basic test code calling the log function and then printing the result on the standard output on Linux, with the Intel C Compiler. I want the code to be linked against libimf (Intel's Math Functions library) and not the…
hdl
  • 1,028
  • 1
  • 9
  • 23
0
votes
2 answers

How to link the libm library in microsoft visual studio 2010

please, could you help me how we link the libm math library in microsoft visual studio 2010, in order to use some trigonometric function in a c program ?
user3466199
  • 21
  • 2
  • 10
0
votes
1 answer

Cannot find symbol 'floor' at runtime

I cross-compiled the http Mongoose server for Android using Linux as BUILD system, android-ndk from Google as toolchain and a custom script that finally executes next command: arm-linux-androideabi-gcc -DANDROID -march=armv7-a -mfpu=neon \ …
earizon
  • 2,099
  • 19
  • 29
0
votes
1 answer

Undefined reference compiling OpenFP

I am using Ubuntu 14.04. I am trying to compile this project OpenFP. Issue is when after I run "configure" shell and use "make" to compile it I receive following error. /usr/bin/ld: openfp_extract-fft.o: undefined reference to symbol…
Murtaza Zaidi
  • 599
  • 3
  • 14
0
votes
1 answer

sin() of libm.so gives the wrong result

This.. awk 'BEGIN{print sin(2.6261)}' should (and normally does) yield 0.492964 but it yields 0.909297 on my embedded motherboard running BusyBox linux. The board I have is a DMP Vortex 86SX. I dont think it has a maths co-processor. The spec of…
RichEarle
  • 21
  • 3
0
votes
1 answer

Objective C pow function mixed precision result

General question on the pow function in objective-c. Why does the following code spit out ans=4.9999999 when the base = 125 NSDecimalNumber * base = [[NSDecimalNumber alloc ]initWithString:@"125"]; NSDecimalNumber * root = [[NSDecimalNumber alloc]…
Michael Rivers
  • 920
  • 2
  • 10
  • 17
0
votes
2 answers

Function sinf from libm doesn't return on ARM QEMU machine

I'm trying to run following code on ARM machine emulated with QEMU. #include "math.h" // Newlib doesn't implement this function. void _exit(int status) { while (1); } int main() { float a = 1.25; float b = sinf(a); return 0; } Used…
mapod
  • 1
  • 1
-1
votes
1 answer

Undefined reference to everything, when using libm

I have a program using the standard maths function in C++. On my Mac, it links just fine using clang, and without even using -lm. However, on Ubuntu, also using clang, after adding -lm to my command line, I get undefined reference to EVERYTHING. I…
danini
  • 365
  • 5
  • 9
-3
votes
1 answer

Where are the implementations of the C libraries?

I want to know how C library implements the sqrt() function. I got the header file math.h in /usr/include. But where is the actual implementation? I am doing a numerical computation project and would like to see the implementations of all the…
user2277550
  • 553
  • 7
  • 22
-3
votes
3 answers

Sqrt function not working

So I'm trying to make a program that calculates the quadratic formula, but when I try to compile the code, I get the following:"undefined reference to sqrt" But I tried defining sqrt via math.h and 2 other times in the code. I have attached my…
Mike
  • 33
  • 5
-4
votes
1 answer

Compilng s_sin.c of GNU libm after changing the source

I want to slightly modify libm's sin function (source: s_sin.c) to experiment with something numerical. However, I don't see how to compile the modified source. I would like to avoid doing "./configure, make". So, to resolve all dependencies, I…
zell
  • 9,830
  • 10
  • 62
  • 115
1 2 3 4
5