I have trouble including a built in library.
I have this among others on top of a custom library I'm making:
and try to use a couple functions from there to break a multi-digit integer into its digit components:
Code:
for ( pwr=(int)log10(intgr); pwr>=0; pwr-- )
{ int tmp = (int)pow((double)10,(double)pwr);
add_tail_int(i,(int)(intgr/tmp));
intgr = intgr % tmp;
}
This is a snip of the code. The rest of the code is irrelevant, including the custom functions I call in this loop. (the custom function add_tail_int() adds the single digit I get from this process into a list).
(Maybe there is a smarter way to do what I'm trying to get done there, but I'm a beginner).
I get this error when compiling with gcc:
Code:
kimon@CENTURION $ gcc BigIntTest.c Integer_standalone.c
/tmp/ccAVnqA0.o: In function `kataxorisi':
Integer_standalone.c:(.text+0x785): undefined reference to `log10'
Integer_standalone.c:(.text+0x7af): undefined reference to `pow'
collect2: ld returned 1 exit status
As if including math.h never happened...
This is the only error I get.
I've tried gcc in DevC++ IDE under Vista (in compatibility mode), gcc in SUA (unix emulator) under Win Vista, and also a recent gcc under linux, and they all produce that error.
The funny thing is that I had been able to compile and run the project in DevC++ under Win XP a while ago, except I no longer have XP, and I don't see why I can't make it work even under the native linux system...
This is my version of gcc:
Code:
kimon@CENTURION $ gcc -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix=-4.1 --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)