From 754d3329a652ea0f1306e985a6e1bb0245275176 Mon Sep 17 00:00:00 2001 From: Andreas Schuh Date: Mon, 15 Oct 2018 00:22:36 -0700 Subject: [PATCH] fix: No extern template declaration for MSVC <12.0 --- .gitignore | 1 + src/gflags.h.in | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 321f70e..706f7f8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /build/ /builds/ /build-*/ +/_build/ .DS_Store CMakeCache.txt DartConfiguration.tcl diff --git a/src/gflags.h.in b/src/gflags.h.in index b437862..7b218b9 100644 --- a/src/gflags.h.in +++ b/src/gflags.h.in @@ -442,10 +442,14 @@ class GFLAGS_DLL_DECL FlagRegisterer { }; // Force compiler to not generate code for the given template specialization. -#define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) \ - extern template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ - const char* name, const char* help, const char* filename, \ - type* current_storage, type* defvalue_storage) +#if defined(_MSC_VER) && _MSC_VER < 1800 // Visual Studio 2013 version 12.0 + #define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) +#else + #define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) \ + extern template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ + const char* name, const char* help, const char* filename, \ + type* current_storage, type* defvalue_storage) +#endif // Do this for all supported flag types. GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(bool);