diff --git a/guetzli.make b/guetzli.make
index a55b4bd9..f4398a0b 100644
--- a/guetzli.make
+++ b/guetzli.make
@@ -24,7 +24,7 @@ ifeq ($(config),release)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
- ALL_LDFLAGS += $(LDFLAGS) -s -lpng -lgflags_nothreads
+ ALL_LDFLAGS += $(LDFLAGS) -s -lpng -lgflags_nothreads -lz
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
@@ -51,7 +51,7 @@ ifeq ($(config),debug)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
- ALL_LDFLAGS += $(LDFLAGS) -lpng -lgflags_nothreads
+ ALL_LDFLAGS += $(LDFLAGS) -lpng -lgflags_nothreads -lz
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
diff --git a/guetzli.vcxproj b/guetzli.vcxproj
index c87ee6a8..4639a143 100644
--- a/guetzli.vcxproj
+++ b/guetzli.vcxproj
@@ -70,6 +70,7 @@
false
true
true
+ shlwapi.lib;%(AdditionalDependencies)
mainCRTStartup
@@ -85,6 +86,7 @@
Console
true
+ shlwapi.lib;%(AdditionalDependencies)
mainCRTStartup
diff --git a/premake5.lua b/premake5.lua
index cf9d1b55..1d31f953 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -13,7 +13,9 @@ workspace "guetzli"
language "C++"
includedirs { ".", "third_party/butteraugli" }
filter "action:gmake"
- linkoptions { "-lpng", "-lgflags_nothreads" }
+ linkoptions { "-lpng", "-lgflags_nothreads", "-lz" }
+ filter "action:vs*"
+ links { "shlwapi" }
filter {}
-- This should work with gflags 2.x. The gflags namespace is absent in
-- gflags-2.0, which is the version in Ubuntu Trusty package repository.