aMule Forum

English => Compilation problems => Topic started by: Radek on January 21, 2006, 12:43:57 PM

Title: 20060121|Win32 - compilation errors in ThreadScheduler.cpp
Post by: Radek on January 21, 2006, 12:43:57 PM
I get this message
Code: [Select]
if g++ -DHAVE_CONFIG_H -I. -I. -I..    -I/mingw/lib/wx/include/msw-unicode-release-static-2.7 -I/mingw/include/wx-2.7 -D__WXMSW__ -mthreads -I./libs -DNOMINMAX -DUSE_EMBEDDED_CRYPTO -W -Wall -Wshadow -Wundef -g -ggdb -fno-inline -D__DEBUG__ -fmessage-length=0 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC   -MT libmuleappcore_a-ThreadScheduler.o -MD -MP -MF ".deps/libmuleappcore_a-ThreadScheduler.Tpo" -c -o libmuleappcore_a-ThreadScheduler.o `test -f 'ThreadScheduler.cpp' || echo './'`ThreadScheduler.cpp; \
then mv -f ".deps/libmuleappcore_a-ThreadScheduler.Tpo" ".deps/libmuleappcore_a-ThreadScheduler.Po"; else rm -f ".deps/libmuleappcore_a-ThreadScheduler.Tpo"; exit 1; fi
ThreadScheduler.cpp: In member function `bool CThreadScheduler::DoAddTask(CThreadTask*)':
ThreadScheduler.cpp:204: error: `GetTickCount' was not declared in this scope
ThreadScheduler.cpp:204: warning: unused variable 'GetTickCount'
ThreadScheduler.cpp: In member function `void* CThreadScheduler::Entry()':
ThreadScheduler.cpp:225: error: `auto_ptr' is not a member of `std'
ThreadScheduler.cpp:225: error: expected primary-expression before '>' token
ThreadScheduler.cpp:225: error: `task' was not declared in this scope
ThreadScheduler.cpp:233: error: `sort' is not a member of `std'
make[3]: *** [libmuleappcore_a-ThreadScheduler.o] Error 1
make[3]: Leaving directory `/home/rb/src/amule-cvs/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/rb/src/amule-cvs/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rb/src/amule-cvs'
make: *** [all] Error 2
I could get rid of some of these errors by adding the following lines to ThreadScheduler.cpp
Code: [Select]
#include               // 20060121/Radek auto_ptr
#include            // 20060121/Radek sort

But the remaining error ist not so easy to fix (for me). Output
Code: [Select]
if g++ -DHAVE_CONFIG_H -I. -I. -I..    -I/mingw/lib/wx/include/msw-unicode-release-static-2.7 -I/mingw/include/wx-2.7 -D__WXMSW__ -mthreads -I./libs -DNOMINMAX -DUSE_EMBEDDED_CRYPTO -W -Wall -Wshadow -Wundef -g -ggdb -fno-inline -D__DEBUG__ -fmessage-length=0 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC   -MT libmuleappcore_a-ThreadScheduler.o -MD -MP -MF ".deps/libmuleappcore_a-ThreadScheduler.Tpo" -c -o libmuleappcore_a-ThreadScheduler.o `test -f 'ThreadScheduler.cpp' || echo './'`ThreadScheduler.cpp; \
then mv -f ".deps/libmuleappcore_a-ThreadScheduler.Tpo" ".deps/libmuleappcore_a-ThreadScheduler.Po"; else rm -f ".deps/libmuleappcore_a-ThreadScheduler.Tpo"; exit 1; fi
ThreadScheduler.cpp: In member function `bool CThreadScheduler::DoAddTask(CThreadTask*)':
ThreadScheduler.cpp:207: error: `GetTickCount' was not declared in this scope
ThreadScheduler.cpp:207: warning: unused variable 'GetTickCount'
make[3]: *** [libmuleappcore_a-ThreadScheduler.o] Error 1
make[3]: Leaving directory `/home/rb/src/amule-cvs/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/rb/src/amule-cvs/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rb/src/amule-cvs'
make: *** [all] Error 2
GetTickCount() seems to be defined in GetTickCount.h. But in this include file we have the following lines
Code: [Select]
#ifndef __WINDOWS__
uint32 GetTickCount();
#endif
So - GetTickCount() is not defined in Win32-Environment  ?(
Title: Re: 20060121|Win32 - compilation errors in ThreadScheduler.cpp
Post by: Xaignar on January 21, 2006, 09:14:02 PM
GetTickCount should be a standard function under windows, and GetTickCount.h should include the appropriate headers for that, so I'm not sure why it failed. As for the other problems, I blame GCC4 (and have commited your fixed ;)).
Title: Re: 20060121|Win32 - compilation errors in ThreadScheduler.cpp
Post by: Radek on January 22, 2006, 12:45:43 AM
I searched a little, found out that winbase.h has to be included at some point or other for GetTickCount() to be defined under M$Windows, and came up with this hotfix for GetTickCount.h
Code: [Select]
#ifndef __WINDOWS__
uint32 GetTickCount();
#else                   // 20060121/Radek needed under Windows...
#include
#endif
The else-branch is new. The header file seemed to be the logical place for this decision, as it will be always(?) included if GetTickCount() is needed.

I'm not sure if checking this DEFINE is the correct one here (there seem to be a lot of those having to do with M$Win), but it works for now. Someone with more knowledge of MingW&al. should think  it over, I suppose.

-- Edit
The resulting amulegui.exe throws an uncaught exception when switching to "Transfers" page.
Title: Re: 20060121|Win32 - compilation errors in ThreadScheduler.cpp
Post by: Xaignar on January 22, 2006, 11:11:11 AM
Added.

Quote
The resulting amulegui.exe throws an uncaught exception when switching to "Transfers" page.
Which one?
Title: Re: 20060121|Win32 - compilation errors in ThreadScheduler.cpp
Post by: Radek on January 22, 2006, 12:15:28 PM
amulegui.exe from today's snapshot has the same behaviour. I'll open an extra thread about it, after trying with gdb.

The exception opens a popup window and after less than a second amulegui ends itself. With gdb I hope to be able to give some more input to you.