diff --git a/projectfiles/VC9/wesnoth.vcproj b/projectfiles/VC9/wesnoth.vcproj
index b99d2c3dbb7..fbc3155ed62 100644
--- a/projectfiles/VC9/wesnoth.vcproj
+++ b/projectfiles/VC9/wesnoth.vcproj
@@ -14824,7 +14824,7 @@
>
@@ -14884,7 +14884,7 @@
>
diff --git a/src/ai/lua/lua_object.cpp b/src/ai/lua/lua_object.cpp
index 64dc52b4335..f2014b2d9a2 100644
--- a/src/ai/lua/lua_object.cpp
+++ b/src/ai/lua/lua_object.cpp
@@ -35,6 +35,9 @@ namespace ai {
// empty
}
+ // MSVC fails to compile without this line
+ template class lua_object;
+
template <>
boost::shared_ptr lua_object::to_type(lua_State *L, int n)
{