igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] [slightly OT] statically linked executable


From: Tamas Nepusz
Subject: Re: [igraph] [slightly OT] statically linked executable
Date: Mon, 16 May 2011 13:15:21 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10

> I thought I could compile the program with the -static flag of gcc to 
> obtain a statically linked executable, but at the linking all the 
> function that use igraph function generate errors, so that no executable 
> is produced.
I think -static only tells gcc to "prefer" .a files (i.e. static libraries)
over .so files (dynamic libs). So the question is whether you have
libigraph.a lying around somewhere on your library path.

For the record, the following works for me:

test_igraph_static.c:

#include <igraph/igraph.h>

int main(int argc, char* argv[]) {
        igraph_t graph;
        igraph_famous(&graph, "zachary");
        igraph_destroy(&graph);
}

Command to compile:

gcc -static -o test_igraph_static test_igraph_static.c -I/home/tamas/include
-L/home/tamas/lib -ligraph -lm

(I have the igraph include files in /home/tamas/include/igrpah and the libs
in /home/tamas/lib, so that's why I need the -I and -L switches).

-- 
Tamas



reply via email to

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