From 3e337e3e9717a7efb18cfd89684e70bc28a1773f Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sun, 11 Jun 2017 10:29:43 +0200 Subject: [PATCH] Fix build errors related to template instantiations on Windows The MS compiler doesn't seem to recognize our templates here: g:\jenkins\workspace\simgear-win\source\simgear\embedded_resources\EmbeddedResourceManager.hxx(169): error C3190: 'std::shared_ptr simgear::EmbeddedResourceManager::getResource(const std::string &,const std::string &) const' with the provided template arguments is not the explicit instantiation of any member function of 'simgear::EmbeddedResourceManager' (compiling source file G:\Jenkins\workspace\SimGear-Win\source\simgear\embedded_resources\EmbeddedResourceManager.cxx) [G:\Jenkins\workspace\SimGear-Win\build32\simgear\SimGearCore.vcxproj] g:\jenkins\workspace\simgear-win\source\simgear\embedded_resources\EmbeddedResourceManager.hxx(169): error C2945: explicit instantiation does not refer to a template-class specialization (compiling source file G:\Jenkins\workspace\SimGear-Win\source\simgear\embedded_resources\EmbeddedResourceManager.cxx) [G:\Jenkins\workspace\SimGear-Win\build32\simgear\SimGearCore.vcxproj] -> try without the explicit instantiations on Windows. --- simgear/embedded_resources/EmbeddedResourceManager.hxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/simgear/embedded_resources/EmbeddedResourceManager.hxx b/simgear/embedded_resources/EmbeddedResourceManager.hxx index d371bbd8..66f25b4a 100644 --- a/simgear/embedded_resources/EmbeddedResourceManager.hxx +++ b/simgear/embedded_resources/EmbeddedResourceManager.hxx @@ -163,6 +163,11 @@ private: }; // Explicit template instantiations +// +// MSVC doesn't recognize these as template instantiations of what we defined +// above (this seems to be with “Visual Studio 14 2015”), therefore I'm not +// including them on Windows. +#ifndef _WIN32 template std::shared_ptr EmbeddedResourceManager::getResource(const std::string& virtualPath, @@ -194,6 +199,7 @@ EmbeddedResourceManager::getIStream(const std::string& virtualPath, template std::unique_ptr EmbeddedResourceManager::getIStream(const std::string& virtualPath) const; +#endif // ifndef _WIN32 } // of namespace simgear