List Info

Thread: Beginners problem: Crash with delete_lp with DLL 5.5.0.12 under Vista SP1




Beginners problem: Crash with delete_lp with DLL 5.5.0.12 under Vista SP1
country flaguser name
United States
2008-06-07 09:19:19

Hello,

i am just doing my first steps in using lp_solve in a self written C
program. I use the following program on Win Vista SP1 with Visual
Studio 2005 (i think it is VC7):

#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"

int main(void)
{
int majorversion, minorversion, release, build;
lprec *lp;
int ret;
REAL row[1+2]; /* must be 1 more then number of columns ! */

lp_solve_version(&majorversion, &minorversion, &release, &build);

printf("Version: %d.%d.%d.%dn", majorversion, minorversion,
release, build);

/* Create a new LP model */
lp = make_lp(0, 0);
if(lp == NULL) {
fprintf(stderr, "Unable to create new LP modeln&quot;);
return(1);
}

row[1] = 1.0;
row[2] = 1.0;
add_lag_con(lp, row, LE, 1.0);

ret = lag_solve(lp, 0, 30, FALSE);

printf(&quot;ret = %dn", ret);

delete_lp(lp);
// free_lp(&amp;lp);

printf(&quot;after deleten&quot;);

return(0);
}

I am compiling with:

cl -DWIN32 version.c liblpsolve55.lib

I am using

Microsoft (R) 32-bit C/C++ Optimizing Compiler
Version 14.00.50727.762 for 80x86

The output i get is:

E:vclp_solve>version
Version: 5.5.0.12
ret = -1
then it crashes at delete_lp(lp).

When i use free_lp(&amp;lp) it works. I found earlier posts about similar
problems, but i think they are fixed in newer version ???

I searched my whole system for different version of lpsolve55.dll, but
have not found any older versions and also have the 5.5.0.12 in the
same directory as my exe. Can i be sure, that when i use
lp_solve_version and it gets 5.5.0.12 that i use the DLL 5.5.0.12 and
not only a new *.lib and old DLL ?

Curious thing: When i copy the whole directory to my second computer
(WinXP SP3) it works and i get no crash. Under Win Vista it fails
almost always, sometimes /seldom it works. On Vista i have the IDE
installed, but not started at the same time. On XP the IDE was never
installed. Don't know if it is relevant.

Can someone help me to solve this problem ? If you need more info,
what can i do to narrow the problem ?

BTW: I have seen different version of the *.lib file:
liblpsolve55.lib
liblpsolve55d.lib
lpsolve55.lib

What is the difference and what is the right one ? "d&quot; for debug ?
I tried to use lpsolve55.lib, but then symbol _lag_solve is undefined.
Using liblpsolve55d.lib gives me a lot double defined symbols like
_malloc / __heap_alloc / ... Must i switch off defaultlib as suggested
by compiler ? But using

cl -DWIN32 version.c liblpsolve55d.lib /NODEFAULTLIB:LIBCMTD

gives same errors from linker.

Regards,

Martin

__._,_.___
.

__,_._,___
Re: Beginners problem: Crash with delete_lp with DLL 5.5.0.12 under Vista SP1
country flaguser name
United States
2008-06-07 09:39:01

lag_solve is not working at all in version 5.5. You can only use the
solve function. Secondly, if you are going to use solve, make_lp must
be initialised with the number of columns or rows that you will have
in the model. You will either add rows or columns and for this, you
must have specified huw much columns/rows the model has.

Peter

--- In lp_solve%40yahoogroups.com">lp_solveyahoogroups.com, "capiman26061973" <mailingliste...>
wrote:
>
&gt; Hello,
&gt;
> i am just doing my first steps in using lp_solve in a self written C
> program. I use the following program on Win Vista SP1 with Visual
&gt; Studio 2005 (i think it is VC7):
&gt;
> #include <stdio.h>
>; #include <stdlib.h>
&gt; #include "lp_lib.h"
>
> int main(void)
> {
> int majorversion, minorversion, release, build;
&gt; lprec *lp;
>; int ret;
>; REAL row[1+2]; /* must be 1 more then number of columns ! */
>
> lp_solve_version(&amp;majorversion, &minorversion, &release, &build);
>
> printf(&quot;Version: %d.%d.%d.%dn", majorversion, minorversion,
> release, build);
>
> /* Create a new LP model */
> lp = make_lp(0, 0);
> if(lp == NULL) {
> fprintf(stderr, "Unable to create new LP modeln&quot;);
> return(1);
> }
>
> row[1] = 1.0;
>; row[2] = 1.0;
>; add_lag_con(lp, row, LE, 1.0);
&gt;
> ret = lag_solve(lp, 0, 30, FALSE);
>
> printf(&quot;ret = %dn", ret);
&gt;
> delete_lp(lp);
>; // free_lp(&amp;lp);
>
> printf(&quot;after deleten&quot;);
>;
> return(0);
> }
>
> I am compiling with:
&gt;
> cl -DWIN32 version.c liblpsolve55.lib
&gt;
> I am using
>
> Microsoft (R) 32-bit C/C++ Optimizing Compiler
> Version 14.00.50727.762 for 80x86
&gt;
> The output i get is:
>
> E:vclp_solve>version
> Version: 5.5.0.12
> ret = -1
> then it crashes at delete_lp(lp).
>;
> When i use free_lp(&amp;lp) it works. I found earlier posts about
similar
> problems, but i think they are fixed in newer version ???
>
> I searched my whole system for different version of lpsolve55.dll,
but
&gt; have not found any older versions and also have the 5.5.0.12 in the
> same directory as my exe. Can i be sure, that when i use
> lp_solve_version and it gets 5.5.0.12 that i use the DLL 5.5.0.12
and
&gt; not only a new *.lib and old DLL ?
>
> Curious thing: When i copy the whole directory to my second computer
> (WinXP SP3) it works and i get no crash. Under Win Vista it fails
&gt; almost always, sometimes /seldom it works. On Vista i have the IDE
> installed, but not started at the same time. On XP the IDE was never
&gt; installed. Don't know if it is relevant.
>
> Can someone help me to solve this problem ? If you need more info,
&gt; what can i do to narrow the problem ?
>
> BTW: I have seen different version of the *.lib file:
> liblpsolve55.lib
&gt; liblpsolve55d.lib
> lpsolve55.lib
>
> What is the difference and what is the right one ? "d&quot; for debug ?
> I tried to use lpsolve55.lib, but then symbol _lag_solve is
undefined.
> Using liblpsolve55d.lib gives me a lot double defined symbols like
>; _malloc / __heap_alloc / ... Must i switch off defaultlib as
suggested
> by compiler ? But using
>
> cl -DWIN32 version.c liblpsolve55d.lib /NODEFAULTLIB:LIBCMTD
>
> gives same errors from linker.
>
> Regards,
>
> Martin
&gt;

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )