Sponsored Content
Top Forums Programming C Library reference error using sqrt() - will not compile. Post 302469614 by jim mcnamara on Sunday 7th of November 2010 07:34:04 AM
Old 11-07-2010
Code:
gcc a.c -lm

link in the math library
This User Gave Thanks to jim mcnamara For This Post:
 

8 More Discussions You Might Find Interesting

1. Programming

sqrt

Hi! when i'm trying to compile this lite example on my linux machine I'll get errors and i don't know why.. #include <stdio.h> #include <math.h> /* needed by sqrt() */ int main() { printf("%f", sqrt(10.0)); return (0); } this is the error: /tmp/cc33hNVHK.o: In function... (1 Reply)
Discussion started by: CreamHarry
1 Replies

2. Programming

How compile a library on solaris(like dll in windows)

Hi all, how do i compile a c program into a library on solaris Thanks in advance Zing (3 Replies)
Discussion started by: zing
3 Replies

3. Programming

sqrt is not find???

I was writing a simple program in linux, which includes sqrt function of c. I included the math.h. But when I use gcc to compile it, it gave an error message: /home/murat/tmp/ccOv9upo.o(.text+0x4b): In function `main': : undefined reference to `sqrt' collect2: ld returned 1 exit status I... (2 Replies)
Discussion started by: murataht
2 Replies

4. Solaris

DBI with MySQL client library compile on Solaris

how dow you complie perl module DBI with mysql from /usr/local/mysql/bin keeps going to mysql client for /usr/sfw/bin is it the LD_PATH ???...:confused: error is # perl login.cgi DBI connect('customers;mysql_socket=/tmp/mysql.sock:localhost','root',...) failed: Client does not... (1 Reply)
Discussion started by: photon
1 Replies

5. OS X (Apple)

Canot find library on compile - fixing PKG_CONFIG_PATH isn't working

I am using bash on OSX Leopard. When I attempt ./configure I get this error: checking for OPENSSL... configure: error: Package requirements (openssl) were not met: No package 'openssl' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a... (2 Replies)
Discussion started by: reasonstoprefer
2 Replies

6. UNIX for Dummies Questions & Answers

sqrt in bash

Hi, i have a the following script: #!/bin/bash a=3 b=9 let "c= b*a" let "d=sqrt $c " echo $d But when i execute the code, it gives me the an error saying: line 5: let: d=sqrt 27 : syntax error in expression (error token is "27 ") Can any body tell me what I'm doing wrong? (5 Replies)
Discussion started by: limadario
5 Replies

7. Shell Programming and Scripting

Perl de-reference code reference variable

Guys, May i know how can we de reference the code reference variable.? my $a = sub{$a=shift;$b=shift;print "SUM:",($a+$b),"\n";}; print $a->(4,5); How can we print the whole function ? Please suggest me regarding this. Thanks for your time :) Cheers, Ranga :) (0 Replies)
Discussion started by: rangarasan
0 Replies

8. Programming

Specifying dynamic library path to linker at compile time

I would like to compile a binary that doesnot depend on LD_LIBRARY_PATH as this binary will be setuid to owner and used by other users and since setuid doesnot support LD_LIBRARY_PATH making it independent of LD_LIBRARY_PATH would be great. But I am not able to specify the path of the shared... (1 Reply)
Discussion started by: waavman
1 Replies
SQRT(3) 						   BSD Library Functions Manual 						   SQRT(3)

NAME
cbrt, cbrtf, cbrtl, sqrt, sqrtf, sqrtl -- cube root and square root functions LIBRARY
Math Library (libm, -lm) SYNOPSIS
#include <math.h> double cbrt(double x); float cbrtf(float x); long double cbrtl(long double x); double sqrt(double x); float sqrtf(float x); long double sqrtl(long double x); DESCRIPTION
The cbrt(), cbrtf(), and cbrtl() functions compute the cube root of x. The sqrt(), sqrtf(), and sqrtl() functions compute the non-negative square root of x. RETURN VALUES
The cbrt(), cbrtf(), and cbrtl() functions return the requested cube root. The sqrt(), sqrtf(), and sqrtl() functions return the requested square root unless an error occurs. An attempt to take the sqrt() of negative x raises an invalid exception and causes an NaN to be returned (except that the square root of -0 is valid and equal to -0.) SEE ALSO
fenv(3), math(3) STANDARDS
The cbrt(), cbrtf(), cbrtl(), sqrt(), sqrtf(), and sqrtl() functions conform to ISO/IEC 9899:1999 (``ISO C99''). HISTORY
The cbrt() function appeared in 4.3BSD. The sqrtl() function appeared in FreeBSD 8.0. The cbrtl() function appeared in FreeBSD 9.0. BSD
March 5, 2011 BSD
All times are GMT -4. The time now is 04:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy