[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Re: using the API in C program
From: |
Andrew Makhorin |
Subject: |
[Help-glpk] Re: using the API in C program |
Date: |
Sun, 9 Sep 2007 13:36:49 +0400 |
> First I have to thanks you for your aid. Actually I have always this
> problem that if I use "gcc" to link no problem but not with "g++".
> Case1: this complie and no problem
> ******************************************************************
> gcc -Wall -O2 -I/usr/include/glpk -c -o choco.o choco.c
> g++ -L/usr/lib choco.o -lglpk -o choco
> *****************************************************************
> BUT
> Case2
> if I use this:
> ***************************************************************
> g++ -Wall -O2 -I/usr/include/glpk -c -o choco.o choco.c
> g++ -L/usr/lib choco.o -lglpk -o choco
> ****************************************************************
> I get this list of error:
> :main.cpp:(.text+0x741f): undefined reference to
> `glp_lpx_set_prob_name(LPX*, char*)'
> :main.cpp:(.text+0x742f): undefined reference to
> `glp_lpx_set_obj_dir(LPX*, int)'
> :main.cpp:(.text+0x7441): undefined reference to
> `glp_lpx_set_obj_name(LPX*, char*)'
> ......................................
> :main.cpp:(.text+0x7767): undefined reference to
> `glp_lpx_get_row_prim(LPX*, int)'
> Actually I specify the glpk library by "-lglpk ".
There is something wrong with g++.
The following commands work fine for me (assuming that the current
directory is 'examples'):
g++ -I../include -c -o sample.o sample.c
g++ -L../src/.libs -o sample sample.o -lglpk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-glpk] Re: using the API in C program,
Andrew Makhorin <=