Undefined reference to pow

T

Trespasser

I'm embarrassed. I can't make this go:

#include <math.h>

main(int argc, char ** argv)
{
double result;

result = pow(2.0, 3);

}

I get undefined reference to pow.

Any clues?
 
N

Neelesh Bodas

I'm embarrassed. I can't make this go:

#include <math.h>
prefer #include said:
main(int argc, char ** argv) missing return type
{
double result;

result = pow(2.0, 3);

}

I get undefined reference to pow.
Thats a linker error, not a compilation error. Are you linking the
appropriate libraries?

-N
 
T

Trespasser

Neelesh Bodas said:
On Sep 21, 11:45 am, "Trespasser" <NOSPAM@NOSPAM> wrote:
Thats a linker error, not a compilation error. Are you linking the
appropriate libraries?

-N

Thanks Neelesh for the very quick reply.

Ah, I understand. I need to maybe link in a a mathematics library module
when I compile with GCC. If that's not exactly it, then I think I'm back on
track a bit. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top