COIN-OR::LEMON - Graph Library

Opened 16 years ago

Closed 16 years ago

#268 closed defect (fixed)

min_cost_flow_test.cc does not compile with VS2005

Reported by: Akos Ladanyi Owned by: Peter Kovacs
Priority: blocker Milestone: LEMON 1.1 release
Component: core Version: hg main
Keywords: Cc:
Revision id: 85cb3aa71cce

Description

Compiling...
min_cost_flow_test.cc
Z:\lemon-lp-final\lemon/network_simplex.h(1228) : error C2668: 'sqrt' : ambiguous call to overloaded function
        C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(581): could be 'long double sqrt(long double)'
        C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(533): or 'float sqrt(float)'
        C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(128): or 'double sqrt(double)'
        while trying to match the argument list '(int)'
        Z:\lemon-lp-final\lemon/network_simplex.h(1062) : while compiling class template member function 'bool lemon::NetworkSimplex<GR,F,C>::init(void)'
        with
        [
            GR=GR,
            F=Flow,
            C=Cost
        ]
        ..\..\test\min_cost_flow_test.cc(274) : see reference to class template instantiation 'lemon::NetworkSimplex<GR,F,C>' being compiled
        with
        [
            GR=GR,
            F=Flow,
            C=Cost
        ]
Z:\lemon-lp-final\lemon/network_simplex.h(1228) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Attachments (3)

ns-vs-fix-b72846480f05.patch (2.4 KB) - added by Peter Kovacs 16 years ago.
0c8e5c688440.patch (3.6 KB) - added by Alpar Juttner 16 years ago.
fixes-0c8e5c688440-f2d6d3446adf-4137ef9aacc6.bundle (7.8 KB) - added by Peter Kovacs 16 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 16 years ago by Peter Kovacs

Owner: changed from Alpar Juttner to Peter Kovacs
Status: newassigned

[b72846480f05] contains a fix. Could you please check it?

Changed 16 years ago by Peter Kovacs

Changed 16 years ago by Alpar Juttner

Attachment: 0c8e5c688440.patch added

comment:2 in reply to:  1 ; Changed 16 years ago by Alpar Juttner

Replying to kpeter:

[b72846480f05] contains a fix. Could you please check it?

The changeset [0c8e5c688440] also fixes the other faulty usages of sqrt().

comment:3 in reply to:  2 Changed 16 years ago by Peter Kovacs

Replying to alpar:

The changeset [0c8e5c688440] also fixes the other faulty usages of sqrt().

It is better then mine. I couldn't test it with VS2005.

comment:4 Changed 16 years ago by Akos Ladanyi

min_cost_flow_test.cc still fails to compile (dimacs-solver.cc too for the same reason):

Compiling...
min_cost_flow_test.cc
Z:\lemon-lp-final\lemon/elevator.h(117) : error C2664: 'lemon::DigraphExtender<Base>::NodeMap<_Value>::NodeMap(const lemon::DigraphExtender<Base> &)' : cannot convert parameter 1 from 'const lemon::ReverseDigraph<DGR>' to 'const lemon::DigraphExtender<Base> &'
        with
        [
            Base=lemon::ListDigraphBase,
            _Value=lemon::ListDigraphBase::Node *
        ]
        and
        [
            DGR=const GR
        ]
        and
        [
            Base=lemon::ListDigraphBase
        ]
        Reason: cannot convert from 'const lemon::ReverseDigraph<DGR>' to 'const lemon::DigraphExtender<Base>'
        with
        [
            DGR=const GR
        ]
        and
        [
            Base=lemon::ListDigraphBase
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
        Z:\lemon-lp-final\lemon/elevator.h(108) : while compiling class template member function 'lemon::Elevator<GR,Item>::Elevator(const GR &,int)'
        with
        [
            GR=lemon::ReverseDigraph<const GR>,
            Item=lemon::ListDigraphBase::Node
        ]
        Z:\lemon-lp-final\lemon/circulation.h(361) : see reference to class template instantiation 'lemon::Elevator<GR,Item>' being compiled
        with
        [
            GR=lemon::ReverseDigraph<const GR>,
            Item=lemon::ListDigraphBase::Node
        ]
        Z:\lemon-lp-final\lemon/circulation.h(356) : while compiling class template member function 'void lemon::Circulation<GR,LM,UM,SM>::destroyStructures(void)'
        with
        [
            GR=RevGraph,
            LM=lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<int>,
            UM=lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<int>,
            SM=NegNodeMap
        ]
        Z:\lemon-lp-final\lemon/network_simplex.h(1193) : see reference to class template instantiation 'lemon::Circulation<GR,LM,UM,SM>' being compiled
        with
        [
            GR=RevGraph,
            LM=lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<int>,
            UM=lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<int>,
            SM=NegNodeMap
        ]
        Z:\lemon-lp-final\lemon/network_simplex.h(1065) : while compiling class template member function 'bool lemon::NetworkSimplex<GR,F,C>::init(void)'
        with
        [
            GR=GR,
            F=Flow,
            C=Cost
        ]
        ..\..\test\min_cost_flow_test.cc(274) : see reference to class template instantiation 'lemon::NetworkSimplex<GR,F,C>' being compiled
        with
        [
            GR=GR,
            F=Flow,
            C=Cost
        ]
Z:\lemon-lp-final\lemon/elevator.h(117) : error C2664: 'lemon::DigraphExtender<Base>::NodeMap<_Value>::NodeMap(const lemon::DigraphExtender<Base> &,const _Value &)' : cannot convert parameter 1 from 'const lemon::ReverseDigraph<DGR>' to 'const lemon::DigraphExtender<Base> &'
        with
        [
            Base=lemon::ListDigraphBase,
            _Value=int
        ]
        and
        [
            DGR=const GR
        ]
        and
        [
            Base=lemon::ListDigraphBase
        ]
        Reason: cannot convert from 'const lemon::ReverseDigraph<DGR>' to 'const lemon::DigraphExtender<Base>'
        with
        [
            DGR=const GR
        ]
        and
        [
            Base=lemon::ListDigraphBase
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

comment:5 Changed 16 years ago by Peter Kovacs

The problem was about ItemSetTraits, it seems to be a VS bug again: the template parameter (Graph) of a class conflicted with the public typedef of its ancestor class. For VS the later one prevails. This diagnosis is actually due to Balazs. (Thanks for it.)

The patch [f2d6d3446adf] solves this issue directly, and [4137ef9aacc6] contains unification and fixes for typedefs Graph, Digraph and Parent in order to prevent such problems. For more information see the commit log.

Both of these changesets can be compiled with VS2008 and gcc.

Changed 16 years ago by Peter Kovacs

comment:6 Changed 16 years ago by Alpar Juttner

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.