help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Re: A beginner question


From: Brady Hunsaker
Subject: Re: [Help-glpk] Re: A beginner question
Date: Tue, 16 May 2006 10:47:56 -0400
User-agent: Thunderbird 1.5.0.2 (X11/20060501)

It sounds as though you are new to C programming.

This is not really a GLPK issue. I recommend you do some reading on C compilation using gcc. One resource that looks good is
http://cslibrary.stanford.edu/107/

Some other documents that may be helpful are at
http://cslibrary.stanford.edu/

In your case, it looks like the compiler can't find the header files. The first document above talks about using a Makefile to help organize these issues. It will probably be easiest for you if you can find someone locally who has programmed in C in a unix-like environment.

Further questions about using gcc should probably be directed to a different mailing list.

Brady


Ying wrote:
Bsaint <bsaint2005 <at> gmail.com> writes:


Hi,
I just download glpk-4.9 today. I can run the command like ./glpsol --model transp.mod --output transp.sol under \example Then I want to write c code to solve the problem. #include <stdio.h>#include <stdlib.h>#include "glpk.h" int main(void){ LPX *lpx_read_model('transp.mod', NULL, NULL);} When I use gcc transp.c, it reports:
transp.c:1: error: syntax error before ':' token
May somebody tell me what's wrong here?

Best RegardsRong, Ying


_______________________________________________
Help-glpk mailing list
Help-glpk <at> gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk

Now when I change my code to
#include <stdio.h>
#include <stdlib.h>
#include "glpk.h"


int main(void)
{
    LPX *lp;
    char *model;
    model = "transp.mod";
    char *output;
    output = "transp.out";
    lp = lpx_read_model(model, NULL, output);
}

And I put the code under /include
it reports
transp.c:(.text+0x40): undefined reference to `glp_lpx_read_model'
collect2: ld returned 1 exit status

If I compile sample.c under /include
it reports the similar problems.
/tmp/ccOj7oOg.o: In function `main':
sample.c:(.text+0x20): undefined reference to `glp_lpx_create_prob'
sample.c:(.text+0x36): undefined reference to `glp_lpx_set_prob_name'
sample.c:(.text+0x49): undefined reference to `glp_lpx_set_obj_dir'
sample.c:(.text+0x5c): undefined reference to `glp_lpx_add_rows'
sample.c:(.text+0x77): undefined reference to `glp_lpx_set_row_name'
sample.c:(.text+0xa2): undefined reference to `glp_lpx_set_row_bnds'
sample.c:(.text+0xbd): undefined reference to `glp_lpx_set_row_name'
sample.c:(.text+0xe8): undefined reference to `glp_lpx_set_row_bnds'
sample.c:(.text+0x103): undefined reference to `glp_lpx_set_row_name'
sample.c:(.text+0x12e): undefined reference to `glp_lpx_set_row_bnds'
sample.c:(.text+0x141): undefined reference to `glp_lpx_add_cols'
sample.c:(.text+0x15c): undefined reference to `glp_lpx_set_col_name'
sample.c:(.text+0x183): undefined reference to `glp_lpx_set_col_bnds'
sample.c:(.text+0x1a0): undefined reference to `glp_lpx_set_obj_coef'
sample.c:(.text+0x1bb): undefined reference to `glp_lpx_set_col_name'
sample.c:(.text+0x1e2): undefined reference to `glp_lpx_set_col_bnds'
sample.c:(.text+0x1ff): undefined reference to `glp_lpx_set_obj_coef'
sample.c:(.text+0x21a): undefined reference to `glp_lpx_set_col_name'
sample.c:(.text+0x241): undefined reference to `glp_lpx_set_col_bnds'
sample.c:(.text+0x25e): undefined reference to `glp_lpx_set_obj_coef'
sample.c:(.text+0x3a3): undefined reference to `glp_lpx_load_matrix'
sample.c:(.text+0x3ae): undefined reference to `glp_lpx_simplex'
sample.c:(.text+0x3b9): undefined reference to `glp_lpx_get_obj_val'
sample.c:(.text+0x3cf): undefined reference to `glp_lpx_get_col_prim'
sample.c:(.text+0x3e5): undefined reference to `glp_lpx_get_col_prim'
sample.c:(.text+0x3fb): undefined reference to `glp_lpx_get_col_prim'
sample.c:(.text+0x431): undefined reference to `glp_lpx_delete_prob'

Does anybody have ideas about this kind of problem. Thanks






_______________________________________________
Help-glpk mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk


--
Brady Hunsaker
Assistant Professor
Industrial Engineering
University of Pittsburgh
http://www.engr.pitt.edu/hunsaker/




reply via email to

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