Trying to link lip.C (LIP is long integer package) which contains
calls to log(double) from math.h.
This is test.C, my testing code:
[START CODE]
#include <matrix/gsl_matrix.h>
#include <iostream>
#include <math.h>
#include "lip.h"
using namespace std;
int main()
{
verylong a=0;
verylong b=0;
//zwrite(a);
//zwrite(b);
cout<<"log(100) is: "<< log(100) <<endl;
}
[END CODE]
Now all I'm trying to do is get this file linked with the lip.o file
to create an executable so I can see the whole thing is working.
"g++ -c lip.C" gives me lip.o.
"g++ -c test.C" gives me test.o
"g++ -o out test.o lip.o -lm" should give me 'out' as an executable
but it doesn't, instead giving me:
lip.o(.text+0xf88d): In function `zfread(_IO_FILE*, long**)':
: undefined reference to `log(double)'
lip.o(.text+0xf8b0): In function `zfread(_IO_FILE*, long**)':
: undefined reference to `log(double)'
lip.o(.text+0xfc50): In function `zfwrite_c(_IO_FILE*, long*, long,
char*, char*)':
: undefined reference to `log(double)'
lip.o(.text+0xfc6d): In function `zfwrite_c(_IO_FILE*, long*, long,
char*, char*)':
: undefined reference to `log(double)'
lip.o(.text+0x1097b): In function `zhsread(char*, long**)':
: undefined reference to `log(double)'
lip.o(.text+0x10998): more undefined references to `log(double)'
follow
I can access the log function using other testing code, so the include
and lib references are right. Which brings me here, under the idea
that I'm misusing g++ somehow. I've also tried something like "g++ -o
out test.C lip.C -lm" and get the same error.
Thanks ahead of time.
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus