[Lemon-user] Using NetworkSimplex Algorithm
Alpar Juttner
alpar at cs.elte.hu
Wed Jun 12 18:01:36 CEST 2013
Hi,
> Well, I actually found out that many other "#include" cause the
> problem, not only stdafx.h :(
>
> Seems like it doesn't accept including files rather than lemon ones or
> else it gives compilation errors!! which I can't do as I'm using LEMON
> as a part of my project. Sounds weird, having no clue how this can be
> handled.
LEMON should work seamlessly with _any_ correctly written header files,
we put high emphasis on compatibility, and are very conservative to put
nothing into the global namespace in order to avoid conflicts with other
packages.
Note that, however, the Visual Studio header files are _not_ written
correctly. They are ridiculously badly designed and fails to follow even
the most basic coding principles. For example windows.h has #define
declarations (yes, #define not const values or enums) for random keyword
such as "Arc", "IN" or "OUT". This means that you shoot yourself in the
foot e.g. if the try to name class as "Arc" even if it is in your own
namespace.
It may help if you include the window header _after_ the LEMON ones.
Then it cannot overwrite LEMON's code with its stupid #define
declarations. But it will still spoil your codes.
The only safe solution is to completely avoid including windows.h (or
using in separated .cc files only, see below), whether or not you use
LEMON.
> mmmmm I may separate the Lemon usage parts in different simple files
> (where I won't need to include any external headers) and call them far
> from any other place within my project. Will try it and keep you
> updated.
Why not do it the other way around? Put the guilty one in the prison,
not every one else!
Write wrapper functions for your windows.h calls and place them into a
separate .cc.
In fact, LEMON does the same internally, and does it for the very same
reason. All Windows system call are placed in lemon/bits/windows.cc, and
nowhere else do we use #include<windows.h>.
See http://lemon.cs.elte.hu/trac/lemon/ticket/215 for more details.
Regards,
Alpar
>
> Regards,
> Heba Essam
>
> ________________________________________
> From: Kovács Péter [kpeter at inf.elte.hu]
> Sent: Wednesday, June 12, 2013 10:52 AM
> To: T.A. Heba Essam
> Cc: Alpar Juttner; lemon-user at lemon.cs.elte.hu
> Subject: Re: [Lemon-user] Using NetworkSimplex Algorithm
>
> Hi Heba,
>
> I checked your code example. Without #include "stdafx.h", it compiles
> and runs correctly for me using GCC compiler (well, INFINITE must be
> defined then, e.g. #define INFINITE 1000000).
>
> Therefore, the problem may be related to your stdafx.h or the compiler.
> Could you try compiling the code without including stdafx.h?
>
> Regards,
> Peter
>
>
> On 2013.06.12. 12:24, T.A. Heba Essam wrote:
> > Thanks Alpar :)
> >
> > Then, I still hope if we can figure out the cause of these errors.
> >
> > Regards,
> > Heba
> > ________________________________________
> > From: Alpár Jüttner [alpar.juttner at gmail.com] on behalf of Alpar Juttner [alpar at cs.elte.hu]
> > Sent: Wednesday, June 12, 2013 10:14 AM
> > To: T.A. Heba Essam
> > Cc: Kovács Péter; lemon-user at lemon.cs.elte.hu
> > Subject: Re: [Lemon-user] Using NetworkSimplex Algorithm
> >
> > Hi,
> >
> >> Note: as VS 2010 is 32-bit while LEMON is 64,
> >
> > There is nothing 64-bit specific in LEMON.
> >
> >> can this cause the problem by any means?
> >
> > No, it cannot.
> >
> > Regards,
> > Alpar
> >
> >
> >
> >
>
>
>
>
More information about the Lemon-user
mailing list