This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linker problem - undefined reference after including math lib


Heh. thanks. Sorry, stupid mistake on my part - I forgot to include the
power() function in the source. It works fine now.

Ben Pfaff wrote:

> Ari Pollak <compwiz@bigfoot.com> writes:
>
> > Before you dismiss this as a complete newbie question, please read on.
> > The small program that I compiled has all the necessary header files
> > included (math.h), and it refers to the power() function inside a
> > function called prn_tbl_of_powers().  power is defined at the beginning
> > of the program, with:
> >
> > long power(int, int);
>
> That's not a definition, that's a prototype.  Unless you actually
> provided a definition of power() otherwise, I'm not surprised
> that you're having trouble: power() is not the name of a standard
> ANSI C function.
>
> Why can't you just use pow()?

--
   ___   ___
  / _ | / _ \   Ari Pollak - compwiz@bigfoot.com - www.compwiz.nu
 / __ |/ ___/  ICQ #749825 - AOL IM: aripollak
/_/ |_/_/     Make it idiot proof and someone will make a better idiot.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]