diff --git a/src/util/command-interest-validator.hpp b/src/util/command-interest-validator.hpp
index 6bd3250..2dcc947 100644
--- a/src/util/command-interest-validator.hpp
+++ b/src/util/command-interest-validator.hpp
@@ -17,6 +17,8 @@
 #include "../security/identity-certificate.hpp"
 #include "../security/sec-rule-specific.hpp"
 
+#include <list>
+
 namespace ndn {
 
 class CommandInterestValidator : public Validator
diff --git a/src/util/config-file.hpp b/src/util/config-file.hpp
index 8d49d26..880657a 100644
--- a/src/util/config-file.hpp
+++ b/src/util/config-file.hpp
@@ -15,6 +15,8 @@
 
 #include "../common.hpp"
 
+#include <fstream>
+
 #include <boost/property_tree/ptree.hpp>
 #include <boost/filesystem.hpp>
 
diff --git a/src/util/crypto.cpp b/src/util/crypto.cpp
index 29cbe9d..6e559dd 100644
--- a/src/util/crypto.cpp
+++ b/src/util/crypto.cpp
@@ -13,6 +13,7 @@
 #include "../common.hpp"
 
 #include "crypto.hpp"
+#include "../encoding/buffer-stream.hpp"
 #include "../security/cryptopp.hpp"
 
 namespace ndn {
diff --git a/src/util/io.hpp b/src/util/io.hpp
index 6ca861f..c61dccf 100644
--- a/src/util/io.hpp
+++ b/src/util/io.hpp
@@ -16,6 +16,7 @@
 #include "../common.hpp"
 
 #include "../encoding/block.hpp"
+#include "../encoding/buffer-stream.hpp"
 
 #include <string>
 #include <iostream>
diff --git a/src/util/regex/regex-backref-manager.hpp b/src/util/regex/regex-backref-manager.hpp
index 9ca95ea..a87640c 100644
--- a/src/util/regex/regex-backref-manager.hpp
+++ b/src/util/regex/regex-backref-manager.hpp
@@ -17,6 +17,8 @@
 
 #include "../../common.hpp"
 
+#include <vector>
+
 namespace ndn {
 
 class RegexMatcher;
diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index 8e0e908..6bccffe 100644
--- a/src/util/regex/regex-component-set-matcher.hpp
+++ b/src/util/regex/regex-component-set-matcher.hpp
@@ -20,6 +20,8 @@
 #include "regex-matcher.hpp"
 #include "regex-component-matcher.hpp"
 
+#include <set>
+
 namespace ndn {
 
 class RegexComponentSetMatcher : public RegexMatcher
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index e2317c7..3c95959 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -17,6 +17,8 @@
 #include "regex-backref-manager.hpp"
 #include "regex-pattern-list-matcher.hpp"
 
+#include <boost/lexical_cast.hpp>
+
 namespace ndn {
 
 RegexTopMatcher::RegexTopMatcher(const std::string& expr, const std::string& expand)
diff --git a/src/util/scheduler.hpp b/src/util/scheduler.hpp
index 89892e1..b2a7831 100644
--- a/src/util/scheduler.hpp
+++ b/src/util/scheduler.hpp
@@ -16,6 +16,8 @@
 #include "../common.hpp"
 #include "monotonic_deadline_timer.hpp"
 
+#include <set>
+
 namespace ndn {
 
 struct EventIdImpl; ///< \brief Private storage of information about the event
diff --git a/src/util/time.cpp b/src/util/time.cpp
new file mode 100644
index 0000000..3dacbc6
--- /dev/null
+++ b/src/util/time.cpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (c) 2013-2014,  Regents of the University of California.
+ * All rights reserved.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ *
+ * This file licensed under New BSD License.  See COPYING for detailed information about
+ * ndn-cxx library copyright, permissions, and redistribution restrictions.
+ */
+
+#include "time.hpp"
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+namespace ndn {
+namespace time {
+
+std::string
+toIsoString(const system_clock::TimePoint& timePoint)
+{
+  namespace bpt = boost::posix_time;
+  bpt::ptime ptime = bpt::from_time_t(system_clock::to_time_t(timePoint));
+
+  uint64_t micro = duration_cast<microseconds>(timePoint - getUnixEpoch()).count() % 1000000;
+  if (micro > 0)
+    {
+      ptime += bpt::microseconds(micro);
+      return bpt::to_iso_string(ptime);
+    }
+  else
+    return bpt::to_iso_string(ptime);
+}
+
+
+system_clock::TimePoint
+fromIsoString(const std::string& isoString)
+{
+  namespace bpt = boost::posix_time;
+  static bpt::ptime posixTimeEpoch = bpt::from_time_t(0);
+
+  bpt::ptime ptime = bpt::from_iso_string(isoString);
+
+  system_clock::TimePoint point =
+    system_clock::from_time_t((ptime - posixTimeEpoch).total_seconds());
+  point += microseconds((ptime - posixTimeEpoch).total_microseconds() % 1000000);
+  return point;
+}
+
+
+std::string
+toString(const system_clock::TimePoint& timePoint,
+         const std::string& format/* = "%Y-%m-%d %H:%M:%S"*/,
+         const std::locale& locale/* = std::locale("C")*/)
+{
+  namespace bpt = boost::posix_time;
+  bpt::ptime ptime = bpt::from_time_t(system_clock::to_time_t(timePoint));
+
+  uint64_t micro = duration_cast<microseconds>(timePoint - getUnixEpoch()).count() % 1000000;
+  ptime += bpt::microseconds(micro);
+
+  bpt::time_facet* facet = new bpt::time_facet(format.c_str());
+  std::ostringstream formattedTimePoint;
+  formattedTimePoint.imbue(std::locale(locale, facet));
+  formattedTimePoint << ptime;
+
+  return formattedTimePoint.str();
+}
+
+
+system_clock::TimePoint
+fromString(const std::string& formattedTimePoint,
+           const std::string& format/* = "%Y-%m-%d %H:%M:%S"*/,
+           const std::locale& locale/* = std::locale("C")*/)
+{
+  namespace bpt = boost::posix_time;
+  static bpt::ptime posixTimeEpoch = bpt::from_time_t(0);
+
+  bpt::time_input_facet* facet = new bpt::time_input_facet(format);
+  std::istringstream is(formattedTimePoint);
+
+  is.imbue(std::locale(locale, facet));
+  bpt::ptime ptime;
+  is >> ptime;
+
+  system_clock::TimePoint point =
+    system_clock::from_time_t((ptime - posixTimeEpoch).total_seconds());
+  point += microseconds((ptime - posixTimeEpoch).total_microseconds() % 1000000);
+  return point;
+}
+
+} // namespace time
+} // namespace ndn
diff --git a/src/util/time.hpp b/src/util/time.hpp
index 3bc4e4f..98d27e8 100644
--- a/src/util/time.hpp
+++ b/src/util/time.hpp
@@ -15,7 +15,6 @@
 
 #include "../common.hpp"
 #include <boost/chrono.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
 
 namespace ndn {
 namespace time {
@@ -138,21 +137,8 @@
  *   - with fractional milliseconds: 20020131T100001,123
  *   - without fractional seconds:   20020131T100001
  */
-inline std::string
-toIsoString(const system_clock::TimePoint& timePoint)
-{
-  namespace bpt = boost::posix_time;
-  bpt::ptime ptime = bpt::from_time_t(system_clock::to_time_t(timePoint));
-
-  uint64_t micro = duration_cast<microseconds>(timePoint - getUnixEpoch()).count() % 1000000;
-  if (micro > 0)
-    {
-      ptime += bpt::microseconds(micro);
-      return bpt::to_iso_string(ptime);
-    }
-  else
-    return bpt::to_iso_string(ptime);
-}
+std::string
+toIsoString(const system_clock::TimePoint& timePoint);
 
 /**
  * \brief Convert from the ISO string (YYYYMMDDTHHMMSS,fffffffff) representation
@@ -166,19 +152,8 @@
  *   - without fractional seconds:   20020131T100001
  *
  */
-inline system_clock::TimePoint
-fromIsoString(const std::string& isoString)
-{
-  namespace bpt = boost::posix_time;
-  static bpt::ptime posixTimeEpoch = bpt::from_time_t(0);
-
-  bpt::ptime ptime = bpt::from_iso_string(isoString);
-
-  system_clock::TimePoint point =
-    system_clock::from_time_t((ptime - posixTimeEpoch).total_seconds());
-  point += microseconds((ptime - posixTimeEpoch).total_microseconds() % 1000000);
-  return point;
-}
+system_clock::TimePoint
+fromIsoString(const std::string& isoString);
 
 /**
  * \brief Convert time point to string with specified format
@@ -193,24 +168,10 @@
  * \sa http://www.boost.org/doc/libs/1_48_0/doc/html/date_time/date_time_io.html#date_time.format_flags
  *     described possible formatting flags
  **/
-inline std::string
+std::string
 toString(const system_clock::TimePoint& timePoint,
          const std::string& format = "%Y-%m-%d %H:%M:%S",
-         const std::locale& locale = std::locale("C"))
-{
-  namespace bpt = boost::posix_time;
-  bpt::ptime ptime = bpt::from_time_t(system_clock::to_time_t(timePoint));
-
-  uint64_t micro = duration_cast<microseconds>(timePoint - getUnixEpoch()).count() % 1000000;
-  ptime += bpt::microseconds(micro);
-
-  bpt::time_facet* facet = new bpt::time_facet(format.c_str());
-  std::ostringstream formattedTimePoint;
-  formattedTimePoint.imbue(std::locale(locale, facet));
-  formattedTimePoint << ptime;
-
-  return formattedTimePoint.str();
-}
+         const std::locale& locale = std::locale("C"));
 
 /**
  * \brief Convert from string of specified format into time point
@@ -225,26 +186,10 @@
  * \sa http://www.boost.org/doc/libs/1_48_0/doc/html/date_time/date_time_io.html#date_time.format_flags
  *     described possible formatting flags
  */
-inline system_clock::TimePoint
+system_clock::TimePoint
 fromString(const std::string& formattedTimePoint,
            const std::string& format = "%Y-%m-%d %H:%M:%S",
-           const std::locale& locale = std::locale("C"))
-{
-  namespace bpt = boost::posix_time;
-  static bpt::ptime posixTimeEpoch = bpt::from_time_t(0);
-
-  bpt::time_input_facet* facet = new bpt::time_input_facet(format);
-  std::istringstream is(formattedTimePoint);
-
-  is.imbue(std::locale(locale, facet));
-  bpt::ptime ptime;
-  is >> ptime;
-
-  system_clock::TimePoint point =
-    system_clock::from_time_t((ptime - posixTimeEpoch).total_seconds());
-  point += microseconds((ptime - posixTimeEpoch).total_microseconds() % 1000000);
-  return point;
-}
+           const std::locale& locale = std::locale("C"));
 
 } // namespace time
 } // namespace ndn
