Menu

Library linking problem

2009-09-26
2012-09-26
  • Rodrigo Cesar Silva

    I made a lot a search in the forum, but i still cannot solve my problem.
    I am using devc++ 4.9.9.2 under windows vista.
    Below is the demo code i am trying to execute:

    include stdio.h>

    include stdlib.h>

    include "lp_lib.h"

    int main(int argc, char *argv)
    {

    lprec *lp;

    lp = make_lp(0,4);

    / ... /

    delete_lp(lp);

    system("PAUSE");
    return 0;
    }

    This program needs a library from LPSolve (a linear programming solver) named
    liblpsolve.a.
    The library and header files are available at https://sourceforge.net/project
    s/lpsolve/files/lpsolve/5.5.0.15/lp_solve_5.5.0.15_dev_ux32.tar.gz/download.

    I did put all the header files in C:\Dev-Cpp\include and the library in C
    :\Dev-Cpp\lib.

    Then, i created a projetc with this demo.c file. In Project Options/Parameters
    i inserted -llpsolve55 in the linker box.

    When i run my project i get the following Compile Log:

    Compiler: Default compiler
    Building Makefile: "C:\projetos\Makefile.win"
    Executing make clean
    rm -f demo.o LPSolve.exe

    gcc.exe -c demo.c -o demo.o -I"C:/Dev-Cpp/include"

    gcc.exe demo.o -o "LPSolve.exe" -L"C:/Dev-Cpp/lib"
    -llpsolve55 -llpsolve55

    demo.o(.text+0x3a):demo.c: undefined reference to make_lp@8' demo.o(.text+0x4b):demo.c: undefined reference todelete_lp@4'
    collect2: ld returned 1 exit status

    make.exe: *** Error 1

    Execution terminated

    It seems that the compiler can not find the library.

    Instructions for calling LPSolve API from C is available at http://lpsolve.so
    urceforge.net/5.5/Build.htm

    Can someone help me!?

     
  • cpns

    cpns - 2009-09-26

    The probability is that the library you have downloaded is intended for use
    with GCC on Linux. You need a build for MinGW/GCC on Windows. That may be
    included in one of the other available packages, but I'll leave that for you
    to explore. I suggest that you at least need to download one of teh Win32
    versions, but even then if it is built for a different compiler it will not
    work with MinGW/GCC. If that is the case you will need to build the libary
    from source. I suggest that you raise this with the LP-Solve project or its
    support page.

    I guess it will take a while for everyone to get the hang of the new
    SourceForge markup. Unfortunately SourceForge have also managed to implement
    it badly as well and incorporate a few bugs. The post does not always appear
    as in the preview. The worrying thing is that other forums seemed to have
    managed this years ago. StackOverflow even uses teh same markup and preview
    system, but managed to get it right from day one of its existence.

    At the top of the forum is an invitation to complete a survey about the new
    site design. I urge everyone to complete it and express dissatisfaction with
    the markup and lack of after-post editing.

    Clifford

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.