Bug report #4121

MSVC: build fails due to "'fabs' : ambiguous call to overloaded function"

Added by Alister Hood almost 9 years ago. Updated almost 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Build/Install
Affected QGIS version: Regression?:No
Operating System:Windows (MSVC) Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data: Copied to github as #:14102

Description

In trunk after the new "point pattern" and "line pattern" symbol layer types were added, the build fails like this:

2>..\\..\\..\\qgis.git\\src\\core\\symbology-ng\\qgsfillsymbollayerv2.cpp(445) : error C2668: 'fabs' : ambiguous call to overloaded function
2> C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include\\math.h(557): could be 'long double fabs(long double)'
2> C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include\\math.h(509): or 'float fabs(float)'
2> C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include\\math.h(119): or 'double fabs(double)'
2> while trying to match the argument list '(int)'

Something like this fixes it:

diff --git "a/C:\\\\DOCUME~1\\\\ALISTE~1.HOO\\\\LOCALS~1\\\\Temp\\\\qgsFD6.cpp" "b/C:\\\\OSGeo4W\\\\building\\\\qgis.git\\\\src\\\\core\\\\symbology-ng\\\\qgsfillsymbollayerv2.cpp"
index 8e29a65..cc49756 100644
--- "a/C:\\\\DOCUME~1\\\\ALISTE~1.HOO\\\\LOCALS~1\\\\Temp\\\\qgsFD6.cpp"
+++ "b/C:\\\\OSGeo4W\\\\building\\\\qgis.git\\\\src\\\\core\\\\symbology-ng\\\\qgsfillsymbollayerv2.cpp"

@@ -437,7 +442,7 @@ void QgsLinePatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& conte

//find a suitable multiple of width and heigh

- QImage patternImage( fabs( width ), height, QImage::Format_ARGB32 );
+ QImage patternImage( fabs( (double)width ), height, QImage::Format_ARGB32 );
patternImage.fill( 0 );
QPainter p( &patternImage );
p.setRenderHint( QPainter::Antialiasing, true );

History

#1 Updated by Jürgen Fischer almost 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF