#11 Build failure on FC3 (gcc 3.3.5), patch proposal

open
nobody
None
5
2005-06-13
2005-06-13
wwp
No

Hi,

I've built scourge 0.10 on a Fedora Core 3 GNU/Linux system using gcc 3.3.5 and
faced the error below:

effect.cpp: In member function `void Effect::drawParticle(ParticleStruct*)':
effect.cpp:523: error: call of overloaded `abs(GLfloat)' is ambiguous
/usr/include/stdlib.h:778: note: candidates are: int abs(int)
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/cstdlib:153: note: long long int __gnu_cxx::abs(long long int)
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/cstdlib:123: note: long int std::abs(long int)
make[3]: *** [effect.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2

the following patch does the trick (dunno if it's really pertinent but I checked at
the other calls to abs() in the code):

--- src/effect.cpp.orig 2005-06-13 16:16:12.000000000 +0200
+++ src/effect.cpp 2005-06-13 16:15:50.000000000 +0200
@@ -520,7 +520,7 @@
//float d = (float)(shape->getDepth() / GLShape::DIV) / 2.0;
h = (float)(shape->getHeight() / GLShape::DIV) / 3.0f;
if(h == 0) h = 0.25 / GLShape::DIV;
- sh = ((float)( abs( (particle->z - particle->startZ ) / GLShape::DIV) / 3.0f);
+ sh = ((float)( abs( (int)(particle->z - particle->startZ) ) / GLShape::DIV) / 3.0f);
if(h == 0) h = 0.25 / GLShape::DIV;

Discussion

  • wwp
    wwp
    2005-06-13

    unified context patch (diff -urN output)