[Help-glpk] How to compile and link the example "sample.c"
From:
Zhu Liang
Subject:
[Help-glpk] How to compile and link the example "sample.c"
Date:
Wed, 22 Apr 2009 11:29:33 -0700
Hi all
Could you specify how to compile and link sample.c.
When I try "gcc sample.c /usr/local/lib/libglpk.a -o sample.out", there comes a lot of linking errors; see below. I remembered I have successfully compiled and linked it. However, I forgot how I got it..
Thanks.
Liang
gcc sample.c /usr/local/lib/libglpk.a -o example.out /usr/local/lib/libglpk.a(glpios03.o): In function `efficacy': /home/zhuliang/software/glpk-4.36/src/glpios03.c:1768: undefined reference to `sqrt'
/usr/local/lib/libglpk.a(glpios03.o): In function `parallel': /home/zhuliang/software/glpk-4.36/src/glpios03.c:1796: undefined reference to `sqrt' /usr/local/lib/libglpk.a(glpipm.o): In function `basic_info':
/home/zhuliang/software/glpk-4.36/src/glpipm.c:631: undefined reference to `sqrt' /home/zhuliang/software/glpk-4.36/src/glpipm.c:636: undefined reference to `sqrt' /home/zhuliang/software/glpk-4.36/src/glpipm.c:645: undefined reference to `sqrt'
/usr/local/lib/libglpk.a(glpipm.o):/home/zhuliang/software/glpk-4.36/src/glpipm.c:650: more undefined references to `sqrt' follow /usr/local/lib/libglpk.a(glpmpl03.o): In function `_glp_mpl_fp_normal01': /home/zhuliang/software/glpk-4.36/src/glpmpl03.c:374: undefined reference to `log'
/home/zhuliang/software/glpk-4.36/src/glpmpl03.c:374: undefined reference to `sqrt' /usr/local/lib/libglpk.a(glpmpl03.o): In function `_glp_mpl_fp_trunc':