[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] C igraph compilation problem on Lion

From: Tamas Nepusz
Subject: Re: [igraph] C igraph compilation problem on Lion
Date: Mon, 14 Nov 2011 16:55:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1

> While I still cannot build the program using 
> -l/opt/local/lib/libigraph.a, I can build it using just -ligraph option.
Aaah okay. If I remember correctly, the -l switch does not support linking
to static libraries (those with ".a" as the extension). So basically you
have two choices:

1) If you want to link to igraph dynamically, just use "-L/opt/local/lib

2) If you want to link to igraph statically, just add
"/opt/local/lib/libigraph.a" at the end of the command line, without using
the "-l" switch. (The "-l" switch basically asks the compiler to look for
the library with the given name in the library path, and
"/opt/local/lib/libigraph.a" cannot be interpreted as a library name).

Note that in case 2), it is likely that you also have to link to the math
library ("m"), either dynamically or statically. E.g., the following does
not work for me:

gcc -o main main.c /home/tamas/lib/libigraph.a -I/home/tamas/include

because it complains about undefied references to functions like "pow" or
"log", all of which are to be found in the math library. Linking to the math
library dynamically resolves the problem:

gcc -o main main.c /home/tamas/lib/libigraph.a -I/home/tamas/include -lm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]