aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: [WebServer.cpp] ambiguous overload  (Read 3964 times)

thermoman

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 40
[WebServer.cpp] ambiguous overload
« 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
Logged
Gentoo & Bittorrent User

thermoman

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 40
Solution
« Reply #1 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
Logged
Gentoo & Bittorrent User

Avi

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 35
Re: [WebServer.cpp] ambiguous overload
« Reply #2 on: July 13, 2004, 10:12:04 AM »

Could you also use wxEmptyString?  ;)
Logged

thermoman

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 40
Re: [WebServer.cpp] ambiguous overload
« Reply #3 on: July 13, 2004, 10:53:43 AM »

Its strange - this only occures when used in

bool ? a : b

but not in normal contect.
Logged
Gentoo & Bittorrent User

Mon

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Re: [WebServer.cpp] ambiguous overload
« Reply #4 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
« Last Edit: July 13, 2004, 03:51:04 PM by Mon »
Logged

thermoman

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 40
Re: [WebServer.cpp] ambiguous overload
« Reply #5 on: July 13, 2004, 06:02:46 PM »

The real haxxor way:

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

:)
Logged
Gentoo & Bittorrent User