aMule Forum

English => en_Bugs => Topic started by: thermoman on July 13, 2004, 03:33:26 AM

Title: [WebServer.cpp] ambiguous overload
Post by: thermoman on July 13, 2004, 03:33:26 AM
Hi,

i get this error message while trying to compile rc4:

Code: [Select]
WebServer.cpp: In function `static class wxString CWebServer::_GetTransferList(ThreadData)':
WebServer.cpp:1503: ambiguous overload for `bool ? wxString & : const char[1]'
WebServer.cpp:1503: candidates are: operator ?:(bool, wxString, wxString)
WebServer.cpp:1503:                 operator ?:(bool, const wxChar *, const char *)
WebServer.cpp:1503:                 operator ?:(bool, const wxChar *, const char *)

it is this line:

Code: [Select]
Out.Replace(wxT("[ClearCompletedButton]"),(completedAv && IsSessionAdmin(Data,sSession)) ? pThis->m_Templates.sClearCompleted : wxT(""));
i rewrote this line and substituted it with the following code which compiled without error:

Code: [Select]
       wxString tmp_thermoman;

        if (completedAv && IsSessionAdmin(Data,sSession)) {
            tmp_thermoman = pThis->m_Templates.sClearCompleted;
        } else {
            tmp_thermoman = wxT("");
        }

        Out.Replace(wxT("[ClearCompletedButton]"),tmp_thermoman);

This should be the same semantic - and it compiled well. I don't see the problem with the '?' operator. Give me a hint.

thermoman
Title: Solution
Post by: thermoman on July 13, 2004, 03:53:26 AM
Finally found the solution myself:

http://www.amule.org/amule/thread.php?threadid=533

You have to replace the wxT("") things with wxString("") in WebServer.cpp and DownloadClient.cpp

Greetings,
thermoman
Title: Re: [WebServer.cpp] ambiguous overload
Post by: Avi on July 13, 2004, 10:12:04 AM
Could you also use wxEmptyString?  ;)
Title: Re: [WebServer.cpp] ambiguous overload
Post by: thermoman on July 13, 2004, 10:53:43 AM
Its strange - this only occures when used in

bool ? a : b

but not in normal contect.
Title: Re: [WebServer.cpp] ambiguous overload
Post by: Mon on July 13, 2004, 01:13:41 PM
I gave your fix a try, and since im lazy i did it like this:
sed s/"wxT("/"wxString("/g file1.cpp > file2.cpp

However now i get:
Code: [Select]
g++ -DHAVE_CONFIG_H -I. -I. -I..    -I/usr/lib/wx/include/base-2.4 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DWXBASE -I/usr/include/ -D__CRYPTO_DEBIAN_GENTOO__  -O2  -c -o amuleweb-WebServer.o `test -f 'WebServer.cpp' || echo './'`WebServer.cpp
g++  -I/usr/include/ -D__CRYPTO_DEBIAN_GENTOO__  -O2    -o amuleweb  amuleweb-WebServer.o amuleweb-WebInterface.o amuleweb-WebSocket.o amuleweb-MD5Sum.o amuleweb-ECSocket.o -pthread -lwx_base-2.4 -lz
amuleweb-WebInterface.o: In function `CamulewebApp::OnRun(void)':
amuleweb-WebInterface.o(.text+0x7c0): undefined reference to `CWebServer::CWebServer(CamulewebApp *)'
amuleweb-WebInterface.o(.text+0x7ef): undefined reference to `CWebServer::StartServer(void)'
amuleweb-WebInterface.o(.text+0x816): undefined reference to `CWebServer::StopServer(void)'
amuleweb-WebSocket.o: In function `CWSThread::CWSThread(CWebServer *)':
amuleweb-WebSocket.o(.text+0x2b): undefined reference to `CWebServer::GetWSPort(void)'
amuleweb-WebSocket.o: In function `CWSThread::Entry(void)':
amuleweb-WebSocket.o(.text+0x80): undefined reference to `CWebServer::Print(char *,...)'
amuleweb-WebSocket.o(.text+0xbf): undefined reference to `CWebServer::Print(char *,...)'
amuleweb-WebSocket.o(.text+0x142): undefined reference to `CWebServer::Print(char *,...)'
amuleweb-WebSocket.o(.text+0x1bb): undefined reference to `CWebServer::Print(char *,...)'
amuleweb-WebSocket.o(.text+0x2ba): undefined reference to `CWebServer::Print(char *,...)'
amuleweb-WebSocket.o(.text+0x31d): more undefined references to `CWebServer::Print(char *,...)' follow
amuleweb-WebSocket.o: In function `CWebSocket::OnRequestReceived(char *, unsigned int, char *, unsigned int)':
amuleweb-WebSocket.o(.text+0xfcc): undefined reference to `CWebServer::ProcessURL(ThreadData)'
amuleweb-WebSocket.o(.text+0x1022): undefined reference to `CWebServer::ProcessStyleFileReq(ThreadData)'
amuleweb-WebSocket.o(.text+0x107c): undefined reference to `CWebServer::ProcessImgFileReq(ThreadData)'
collect2: ld returned 1 exit status

Did my wannabe haxor sed command change something that shoulnd't be changed?

Edit:
I just took the sed command from the Debian howto. I never used sed before. Appearantly it left me with empty WebServer.cpp and DownloadClient.cpp files. If anyone else wants to use sed to replace all the wxT("") things with wxString("") do it something like this:
Code: [Select]
sed s/"wxT("/"wxString("/g WebServer.cpp > temp && mv temp WebServer.cpp && sed s/"wxT("/"wxString("/g DownloadClient.cpp > temp && mv temp DownloadClient.cpp

maybe ugly, but gets "the job done" [TM] :D
Title: Re: [WebServer.cpp] ambiguous overload
Post by: thermoman on July 13, 2004, 06:02:46 PM
The real haxxor way:

perl -p -i -e 's/wxT\(/wxString\(/g' WebServer.cpp DownloadClient.cpp

:)