Error Undefined Symbol .pow
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined reference to pow( ) in C, despite including math.h [duplicate] up vote 17 down vote favorite 6 Possible Duplicate: Problem using pow() in C what is 'undefined reference to `pow'' I'm having a bit of an issue with a simple piece of coursework for uni that's really puzzling me. Essentially, I've to write a program that, amongst other things, calculates the volume of a sphere from a given radius. I thought I'd use the pow() function rather than simply using r*r*r, for extra Brownie points, but the compiler keeps giving me the following error: undefined reference to 'pow' collect2: error: ld returned 1 exit status My code looks like the following: #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined Reference error for power function in C [duplicate] http://stackoverflow.com/questions/12824134/undefined-reference-to-pow-in-c-despite-including-math-h up vote 1 down vote favorite Possible Duplicate: Problem using pow() in C Undefined reference to pow' andfloor' I am using gcc 4.6.1. Code snippet: int main(void) { int x= 2; int y = pow(3,x); printf("%d\n",y); return 0; } Terminal: avinash@titanic:~/Desktop/DSF$ gcc power.c -o power /tmp/ccTJ7vAH.o: In function `main': power.c:(.text+0x25): undefined reference to `pow' collect2: ld returned 1 exit status If I replace x by 2 then it http://stackoverflow.com/questions/9025015/undefined-reference-error-for-power-function-in-c gets executed in an expected way. Doesn't pow function accepts variables as it's parameters? Note: I have included stdio.h and math.h in the source file. c gcc pow share|improve this question edited Sep 15 at 13:23 metadings 2,72411429 asked Jan 26 '12 at 20:40 Avinash Sonawane 41125 marked as duplicate by Tim Cooper, ruakh, Bo Persson, Mac, pmg Jan 26 '12 at 20:51 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. If you have pow(3,2) the compiler can compute that directly and doesn't have to call the function. –Bo Persson Jan 26 '12 at 20:45 If you included stdio.h and math.h in the source file, then show us that in the code rather than showing us incomplete code and then telling us what's missing. –Keith Thompson Jan 26 '12 at 20:54 @KeithThompson- Sorry. But "include" term was appearing to be Bold without actually going for the bold type. So I dropped the #include lines, but i have mentioned that I have included both the libraries under note. –Avinash Sonawane Jan 26 '12 at 21:00 add a comment| 2 A
every time I a try to compile a program with math functions. ld: 0711-317 ERROR: Undefined symbol: .pow ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: ld returned 8 exit status http://www.justskins.com/forums/math-function-error-97629.html Any help would be appreciated. -- Amadou O. Wane Online Faculty University of Phoenix Tampa, FL (813) 814-4234 [Eastern Time Zone] [email]amadouW0000email.uophx.edu[/email] [email]waneintechs.net[/email] (alternate)... Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… http://www.imagemagick.org/discourse-server/viewtopic.php?t=19470 Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode June 30th,09:59 PM #1 Math function error Hello, I get this error every time I a try to compile a program with math functions. ld: error undefined 0711-317 ERROR: Undefined symbol: .pow ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: ld returned 8 exit status Any help would be appreciated. -- Amadou O. Wane Online Faculty University of Phoenix Tampa, FL (813) 814-4234 [Eastern Time Zone] [email]amadouW0000email.uophx.edu[/email] [email]waneintechs.net[/email] (alternate) AMADIUM Guest June 30th,10:11 PM #2 Re: Math function error AMADIUM wrote: > > Hello, > I get this error every time I a try error undefined symbol to compile a program with math > functions. > > ld: 0711-317 ERROR: Undefined symbol: .pow > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more > information. > collect2: ld returned 8 exit status > > Any help would be appreciated. > > -- > Amadou O. Wane > Online Faculty > University of Phoenix > Tampa, FL > (813) 814-4234 [Eastern Time Zone] > [email]amadouW0000email.uophx.edu[/email] > [email]waneintechs.net[/email] (alternate) Try adding "-lm" to the end of your compile line. This will cause the math library (libmath) to be included in your compile. -- Fletcher Glenn email [email]f-g-l-e-n-nquest.com[/email] (remove the dashes) Fletcher Glenn Guest June 30th,10:13 PM #3 Re: Math function error Fletcher Glenn wrote: > > AMADIUM wrote: > > > > Hello, > > I get this error every time I a try to compile a program with math > > functions. > > > > ld: 0711-317 ERROR: Undefined symbol: .pow > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more > > information. > > collect2: ld returned 8 exit status > > > > Any help would be appreciated. > > > > -- > > Amadou O. Wane > > Online Faculty > > University of Phoenix > > Tampa, FL >
find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here. Post Reply Print view Search Advanced search 3 posts • Page 1 of 1 glar Posts: 2 Joined: 2011-09-13T03:29:38-07:00 Authentication code: 8675308 AIX 6.1 make error Quote Postby glar » 2011-09-13T05:03:04-07:00 Hello,on AIX 6.1 I'm getting an error from "make" trying to compile ImageMagick 6.7.2 or 6.3.2. Thanks for any suggestionsGlar---------------------------------------------------------------------------------------------------/bin/sh ./libtool --silent --tag=CC --mode=link gcc -g -O2 -Wall -W -D_THREAD_SAFE -o utilities/animate utilities/animate.o magick/libMagick.la wand/libWand.lald: 0711-317 ERROR: Undefined symbol: .fmodld: 0711-317 ERROR: Undefined symbol: .cosld: 0711-317 ERROR: Undefined symbol: .sinld: 0711-317 ERROR: Undefined symbol: .powld: 0711-317 ERROR: Undefined symbol: .ceilld: 0711-317 ERROR: Undefined symbol: .sqrtld: 0711-317 ERROR: Undefined symbol: .cexpld: 0711-317 ERROR: Undefined symbol: .expld: 0711-317 ERROR: Undefined symbol: .floorld: 0711-317 ERROR: Undefined symbol: .atan2ld: 0711-317 ERROR: Undefined symbol: .hypotld: 0711-317 ERROR: Undefined symbol: .tanld: 0711-317 ERROR: Undefined symbol: .logld: 0711-317 ERROR: Undefined symbol: .log10ld: 0711-317 ERROR: Undefined symbol: .acosld: 0711-317 ERROR: Undefined symbol: .asinld: 0711-317 ERROR: Undefined symbol: .atanld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.collect2: ld returned 8 exit statusmake: 1254-004 The error code from the last command is 1.Stop. Top magick Site Admin Posts: 10371 Joined: 2003-05-31T11:32:55-07:00 Re: AIX 6.1 make error Quote Postby magick » 2011-09-13T06:16:42-07:00 Add -lm to your linker command line. We're not sure why it was not added automatically when ImageMagick was configured. Unfortunately we do not have access to AIX to investigate. Top glar Posts: 2 Joined: 2011-09-13T03:29:38-07:00 Authentication code: 8675308 Re: AIX 6.1 make error Quote Postby glar » 2011-09-13T07:07:28-07:00 magick wrote:Add -lm to your linker command line. We're not sure why it was not added automatically when ImageMagick was configured. Unfortunately we do not have access to AIX to investigate.I'm not famili