diff --git a/examples/cpp/route_guide/BUILD b/examples/cpp/route_guide/BUILD index 2ea012ca2ee62..9a19d895a8c92 100644 --- a/examples/cpp/route_guide/BUILD +++ b/examples/cpp/route_guide/BUILD @@ -39,6 +39,7 @@ cc_binary( ":route_guide_helper", "//:grpc++", "//examples/protos:route_guide", + "@com_google_absl//absl/flags:parse", ], ) @@ -53,6 +54,7 @@ cc_binary( ":route_guide_helper", "//:grpc++", "//examples/protos:route_guide", + "@com_google_absl//absl/flags:parse", ], ) diff --git a/examples/cpp/route_guide/Makefile b/examples/cpp/route_guide/Makefile index ae254230f68d6..0b4940dd4c329 100644 --- a/examples/cpp/route_guide/Makefile +++ b/examples/cpp/route_guide/Makefile @@ -25,7 +25,7 @@ PROTOBUF_UTF8_RANGE_LINK_LIBS = -lutf8_validity HOST_SYSTEM = $(shell uname | cut -f 1 -d_) SYSTEM ?= $(HOST_SYSTEM) CXX = g++ -CPPFLAGS += `pkg-config --cflags protobuf grpc` +CPPFLAGS += `pkg-config --cflags protobuf grpc absl_flags absl_flags_parse` CXXFLAGS += -std=c++17 ifeq ($(SYSTEM),Darwin) LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ $(PROTOBUF_ABSL_DEPS)`\ @@ -35,7 +35,7 @@ LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ $(PROTOB -lgrpc++_reflection\ -ldl else -LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ $(PROTOBUF_ABSL_DEPS)`\ +LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ absl_flags absl_flags_parse $(PROTOBUF_ABSL_DEPS)`\ $(PROTOBUF_UTF8_RANGE_LINK_LIBS) \ -pthread\ -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\ diff --git a/examples/cpp/route_guide/route_guide_client.cc b/examples/cpp/route_guide/route_guide_client.cc index 73983f458d934..af9f2fdda3069 100644 --- a/examples/cpp/route_guide/route_guide_client.cc +++ b/examples/cpp/route_guide/route_guide_client.cc @@ -29,6 +29,7 @@ #include #include +#include "absl/flags/parse.h" #include "helper.h" #ifdef BAZEL_BUILD #include "examples/protos/route_guide.grpc.pb.h" @@ -216,6 +217,7 @@ class RouteGuideClient { }; int main(int argc, char** argv) { + absl::ParseCommandLine(argc, argv); // Expect only arg: --db_path=path/to/route_guide_db.json. std::string db = routeguide::GetDbFileContent(argc, argv); RouteGuideClient guide( diff --git a/examples/cpp/route_guide/route_guide_server.cc b/examples/cpp/route_guide/route_guide_server.cc index 7a6a1c8ecaa13..b037ca0815aa9 100644 --- a/examples/cpp/route_guide/route_guide_server.cc +++ b/examples/cpp/route_guide/route_guide_server.cc @@ -29,6 +29,7 @@ #include #include +#include "absl/flags/parse.h" #include "helper.h" #ifdef BAZEL_BUILD #include "examples/protos/route_guide.grpc.pb.h" @@ -182,6 +183,7 @@ void RunServer(const std::string& db_path) { } int main(int argc, char** argv) { + absl::ParseCommandLine(argc, argv); // Expect only arg: --db_path=path/to/route_guide_db.json. std::string db = routeguide::GetDbFileContent(argc, argv); RunServer(db);