Opened 15 years ago
Closed 15 years ago
#350 closed defect (fixed)
min_cost_flow_test does not build with VS2008
Reported by: | Alpar Juttner | Owned by: | Peter Kovacs |
---|---|---|---|
Priority: | critical | Milestone: | LEMON 1.2 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | Geleji János | |
Revision id: | 2c35bef44dd1 |
Description
The compiler says
[ 79%] Building CXX object test/CMakeFiles/min_cost_flow_test.dir/min_cost_flow_ test.cc.obj min_cost_flow_test.cc L:\projects\LEMON\hg\win\lemon/cost_scaling.h(947) : error C2668: 'sqrt' : ambig uous call to overloaded function C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(581): cou ld be 'long double sqrt(long double)' C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(533): or 'float sqrt(float)' C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(128): or 'double sqrt(double)' while trying to match the argument list '(int)' L:\projects\LEMON\hg\win\lemon/cost_scaling.h(920) : while compiling cla ss template member function 'void lemon::CostScaling<GR>::startAugment(int)' with [ GR=Digraph ] L:\projects\LEMON\hg\win\test\min_cost_flow_test.cc(528) : see reference to class template instantiation 'lemon::CostScaling<GR>' being compiled with [ GR=Digraph ] NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \nmake.exe"' : return code '0x2' Stop.
Attachments (1)
Change History (6)
Changed 15 years ago by
Attachment: | acf6cb96c7d4.patch added |
---|
comment:1 follow-up: 2 Changed 15 years ago by
comment:2 follow-up: 3 Changed 15 years ago by
Status: | new → assigned |
---|
Replying to alpar:
The attached changeset [acf6cb96c7d4] solves this issue
It is also solved in [f3bc4e9b5f3a] in #340, thus I prefer to apply that patch. (It would not be easy to merge them, since [f3bc4e9b5f3a] reworks these parts of the code.)
but a there is still warning saying that
This is an actual problem. Now, the min. mean cycle classes (see #179) returns the length (cost) of the found cycle in long long
if they are instantiated with int
. This is just because the internal storage needs such a big number type to avoid overflow problems when the cycle costs are computed and usually multiplied by the size of the cycle. But it is not clear whether we should use this type as a return value, too, or not.
So, where should we fix this problem? In the min. mean cycle algorithms, i.e.
LargeValue cycleLength()
-->Value cycleLength()
or in the min cost flow classes, e.g. store the result of cycleLength()
in larger number type.
comment:3 follow-up: 4 Changed 15 years ago by
Replying to kpeter:
Replying to alpar:
The attached changeset [acf6cb96c7d4] solves this issue
It is also solved in [f3bc4e9b5f3a] in #340, thus I prefer to apply that patch. (It would not be easy to merge them, since [f3bc4e9b5f3a] reworks these parts of the code.)
but a there is still warning saying that
This is an actual problem. Now, the min. mean cycle classes (see #179) returns the length (cost) of the found cycle in
long long
if they are instantiated withint
. This is just because the internal storage needs such a big number type to avoid overflow problems when the cycle costs are computed and usually multiplied by the size of the cycle. But it is not clear whether we should use this type as a return value, too, or not.So, where should we fix this problem? In the min. mean cycle algorithms, i.e.
LargeValue cycleLength()
-->Value cycleLength()
or in the min cost flow classes, e.g. store the result of
cycleLength()
in larger number type.
Both are acceptable for me. Choose whichever you want.
comment:4 follow-up: 5 Changed 15 years ago by
Replying to alpar:
Both are acceptable for me. Choose whichever you want.
See [aa8c9008b3de] in #179. Using the original value type for that query function seems to be more natural (similarly to the path length query funtions for shortest path algorithms).
Could you please check whether this patch solves the problem?
comment:5 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to kpeter:
Could you please check whether this patch solves the problem?
Yes, it does. As of [aa8c9008b3de] the repository now compiles without errors and warnings with VS2008.
The attached changeset [acf6cb96c7d4] solves this issue but a there is still warning saying that