--- src/data/memory_chunk.cc
+++ src/data/memory_chunk.cc
@@ -54,6 +54,22 @@
 
 namespace torrent {
 
+const int MemoryChunk::prot_exec;
+const int MemoryChunk::prot_read;
+const int MemoryChunk::prot_write;
+const int MemoryChunk::prot_none;
+const int MemoryChunk::map_shared;
+
+const int MemoryChunk::advice_normal;
+const int MemoryChunk::advice_random;
+const int MemoryChunk::advice_sequential;
+const int MemoryChunk::advice_willneed;
+const int MemoryChunk::advice_dontneed;
+
+const int MemoryChunk::sync_sync;
+const int MemoryChunk::sync_async;
+const int MemoryChunk::sync_invalidate;
+
 uint32_t MemoryChunk::m_pagesize = getpagesize();
 
 inline void
--- src/protocol/request_list.cc
+++ src/protocol/request_list.cc
@@ -52,6 +52,8 @@
 
 namespace torrent {
 
+const int request_list_constants::bucket_count;
+
 const instrumentation_enum request_list_constants::instrumentation_added[bucket_count] = {
   INSTRUMENTATION_TRANSFER_REQUESTS_QUEUED_ADDED,
   INSTRUMENTATION_TRANSFER_REQUESTS_UNORDERED_ADDED,
--- src/torrent/data/file.cc
+++ src/torrent/data/file.cc
@@ -50,6 +50,15 @@
 
 namespace torrent {
 
+const int File::flag_active;
+const int File::flag_create_queued;
+const int File::flag_resize_queued;
+const int File::flag_fallocate;
+const int File::flag_previously_created;
+
+const int File::flag_prioritize_first;
+const int File::flag_prioritize_last;
+
 File::File() :
   m_fd(-1),
   m_protection(0),
--- src/torrent/download.cc
+++ src/torrent/download.cc
@@ -72,6 +72,20 @@
 
 namespace torrent {
 
+const int DownloadInfo::flag_open;
+const int DownloadInfo::flag_active;
+const int DownloadInfo::flag_compact;
+const int DownloadInfo::flag_accepting_new_peers;
+const int DownloadInfo::flag_accepting_seeders;
+const int DownloadInfo::flag_private;
+const int DownloadInfo::flag_meta_download;
+const int DownloadInfo::flag_pex_enabled;
+const int DownloadInfo::flag_pex_active;
+
+const int DownloadInfo::public_flags;
+
+const uint32_t DownloadInfo::unlimited;
+
 const DownloadInfo* Download::info() const { return m_ptr->info(); }
 const download_data* Download::data() const { return m_ptr->data(); }
 
--- src/torrent/peer/connection_list.cc
+++ src/torrent/peer/connection_list.cc
@@ -60,6 +60,11 @@
 
 namespace torrent {
 
+const int ConnectionList::disconnect_available;
+const int ConnectionList::disconnect_quick;
+const int ConnectionList::disconnect_unwanted;
+const int ConnectionList::disconnect_delayed;
+
 ConnectionList::ConnectionList(DownloadMain* download) :
   m_download(download), m_minSize(50), m_maxSize(100) {
 }
--- src/torrent/utils/log.cc
+++ src/torrent/utils/log.cc
@@ -189,7 +189,7 @@
   pthread_mutex_lock(&log_mutex);
   std::for_each(m_first, m_last, std::tr1::bind(&log_slot::operator(),
                                                 std::tr1::placeholders::_1,
-                                                buffer,
+                                                (const char*)buffer,
                                                 std::distance(buffer, first),
                                                 std::distance(log_groups.begin(), this)));
   if (dump_data != NULL)
--- src/utils/instrumentation.h
+++ src/utils/instrumentation.h
@@ -39,6 +39,8 @@
 
 #include <tr1/array>
 
+#include <algorithm>
+
 #include "torrent/common.h"
 #include "torrent/utils/log.h"
 
@@ -118,7 +120,7 @@
 
 inline void
 instrumentation_initialize() {
-  instrumentation_values.assign(int64_t());
+  std::fill(instrumentation_values.begin(), instrumentation_values.end(), int64_t());
 }
 
 inline void
--- src/utils/queue_buckets.h
+++ src/utils/queue_buckets.h
@@ -251,7 +251,7 @@
   instrumentation_update(constants::instrumentation_total[idx], -difference);
 
   // Consider moving these to a temporary dequeue before releasing:
-  std::for_each(begin, end, std::tr1::function<void (value_type)>(&constants::template destroy<value_type>));
+  std::for_each(begin, end, std::tr1::function<void (value_type&)>(&constants::template destroy<value_type>));
   queue_at(idx).erase(begin, end);
 }
 
--- src/torrent/download_info.h
+++ src/torrent/download_info.h
@@ -52,7 +52,7 @@
 
 // This will become a Download 'handle' of kinds.
 
-class DownloadInfo {
+class LIBTORRENT_EXPORT DownloadInfo {
 public:
   typedef std::tr1::function<uint64_t ()>                              slot_stat_type;
 
