#16 Compilation failure on x86_64

v0.7.x
closed-fixed
CJP
5
2007-08-10
2007-08-09
Tomas Groth
No

When compiling on my archlinux x86_64 box with gcc 4.2.1 I get the following error:

g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../intl -I../shared -finput-charset=ISO-8859-1 -fexec-charset=ISO-8859-1 -Wall -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT metaserver.o -MD -MP -MF ".deps/metaserver.Tpo" -c -o metaserver.o metaserver.cpp; \ then mv -f ".deps/metaserver.Tpo" ".deps/metaserver.Po"; else rm -f ".deps/metaserver.Tpo"; exit 1; fi
metaserver.cpp: In member function 'bool CMetaServer::httpPost(const CString&, const CString&)':
metaserver.cpp:195: error: conversion from 'size_t' to 'const CString' is ambiguous
../shared/cstring.h:58: note: candidates are: CString::CString(float)
../shared/cstring.h:57: note: CString::CString(unsigned int)
../shared/cstring.h:56: note: CString::CString(int)
../shared/cstring.h:55: note: CString::CString(bool)
../shared/cstring.h:36: note: CString::CString(const char*) <near match>
metaserver.cpp: In member function 'CString CMetaServer::readStr(unsigned int)':
metaserver.cpp:477: warning: the address of 'buffer' will always evaluate as 'true'
make[2]: *** [metaserver.o] Error 1

Inserting "static_cast<unsigned int>(data.lenght())" fixed the problem for me.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    and a cast also worked for me... (see my post on the developer forum)

     
  • Martin Jansa

    Martin Jansa - 2007-08-09

    Logged In: YES
    user_id=1634510
    Originator: NO

    Problem and solution confirmed
    x86_64, gentoo, gcc-4.2.1

    diff -uNr simulation/metaserver.cpp simulation/metaserver.cpp
    --- simulation/metaserver.cpp 2007-08-09 15:20:46.234554692 +0200
    +++ simulation/metaserver.cpp 2007-08-09 15:19:49.386307930 +0200
    @@ -192,7 +192,7 @@
    "Connection: close\r\n"
    "User-Agent: " + PACKAGE + "/" + VERSION + "\r\n"
    "Content-Type: application/x-www-form-urlencoded\r\n"
    - "Content-Length: " + data.length() + "\r\n"
    + "Content-Length: " + static_cast<unsigned int>(data.length()) + "\r\n"
    "\r\n"
    + data + "\r\n";

     
  • CJP

    CJP - 2007-08-10
    • status: open --> open-fixed
     
  • CJP

    CJP - 2007-08-10
    • assigned_to: nobody --> cornware-cjp
     
  • Tomas Groth

    Tomas Groth - 2007-08-10
    • status: open-fixed --> closed-fixed
     

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

Sign up for the SourceForge newsletter:





No, thanks