2010-06-15

NTP client in C++ using boost::asio, Windows build

In a previous post, I published some code for a client NTP that can write the current date and time on standard output.

The program was built with MinGW that includes g++ version 4.4.0 and using Boost version 1.43 with multithreading and static linking. The _WIN32_WINNT variable is defined to be 0x0501 which indicates that the program is built for a Windows XP target. The command line used was:

g++ -D_WIN32_WINNT=0x0501 -s -O2 NtpClient.cpp -o NtpClient.exe \
   -IC:/Boost/include/boost-1_43 \
   -LC:/Boost/lib \
   -lboost_date_time-mgw44-mt-s-1_43 \
   -lboost_system-mgw44-mt-s-1_43 \
   -lwsock32 \
   -lws2_32

Of course, you have to copy and paste the code from the previous post into the file NtpClient.cpp :-)

0 kommentarer:

Post a Comment