- Published on
Boost.Thread: `GetTickCount64` Error on Windows XP
- Authors

- Name
- Daisuke Kobayashi
- https://twitter.com
At work I am building a DLL that controls one of our machines. Today, after adding a new feature and releasing it to a user, I received a report that the following runtime error was occurring.
エントリポイントが見つかりません
プロシージャエントリポイント GetTickCount64 がダイナミックライブラリ KERNEL32.dll から見つかりませんでした。
Entry Point Not Found
The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll.
After investigating, I found that the DLL target version had been set to Windows Vista or later, which caused Boost.Thread to use GetTickCount64 internally. In boost/thread/win32/thread_primitives.hpp, GetTickCount64 is called when _WIN32_WINNT is Vista (0x0600) or later. Since GetTickCount64 does not exist before Vista, that is what triggered the error.
// <boost/thread/win32/thread_primitives.hpp>
#ifndef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64
#if _WIN32_WINNT >= 0x0600
#define BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64
#endif
#endif
#ifdef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64
using ::GetTickCount64;
#else
inline ticks_type GetTickCount64() { return GetTickCount(); }
#endif
I fixed the following part of targetver.h in the DLL project.
#ifndef WINVER
- #define WINVER 0x0600
+ #define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x0600
+ #define _WIN32_WINNT 0x0501
#endif