#70 Compile error in player.cc

closed
nobody
None
5
2006-12-17
2006-08-30
Anonymous
No

Contact me at (sans x): ewilxtshi at gmail.com

Error when compiling for Linux.

Linux version: Fedora Core release 4 (Stentz)
uname -a: Linux hostname 2.6.17-1.2142_FC4 #1 Tue Jul
11 22:41:14 EDT 2006 i686 i686 i386 GNU/Linux

I've attached a patch file that fixes it.

g++ -c player.cc -o player.o -DLINUX -DVERSION=\"\"
-DDATA_DIR=\".\" -Wall -Iinclude -g
player.cc: In member function ‘int
PLAYER::addTankDamageToMatrix(TANK*, TANK*, int)’:
player.cc:1012: error: call of overloaded ‘abs(double)’
is ambiguous
/usr/include/stdlib.h:784: note: candidates are: int
abs(int)
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/cstdlib:169:
note: long long int __gnu_cxx::abs(long
long int)
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/cstdlib:130:
note: long int std::abs(long int)
player.cc:1017: error: call of overloaded ‘abs(double)’
is ambiguous
/usr/include/stdlib.h:784: note: candidates are: int
abs(int)
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/cstdlib:169:
note: long long int __gnu_cxx::abs(long
long int)
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/cstdlib:130:
note: long int std::abs(long int)
player.cc: In member function ‘void
PLAYER::calcDamageMatrix(TANK*, int)’:
player.cc:1088: error: call of overloaded ‘abs(double)’
is ambiguous
/usr/include/stdlib.h:784: note: candidates are: int
abs(int)
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/cstdlib:169:
note: long long int __gnu_cxx::abs(long
long int)
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/cstdlib:130:
note: long int std::abs(long int)
make: *** [player.o] Error 1

Discussion

  • Nobody/Anonymous

    Patch to fix compile errors (casts values as ints to resolve ambiguity)

     
    Attachments
  • Jesse Smith

    Jesse Smith - 2006-12-17
    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks