Getting gRPC working in c++ VS2017 from scratch without CMake

24 views
Skip to first unread message

Pablo Perez

unread,
Feb 24, 2021, 12:30:02 PMFeb 24
to grpc.io

This question might seem as already asked, but trust me when I say there is not place where this question is explained clearly.

I got gRPC using vcpkg. The idea is to get its helloworld project working without using CMake, just by creating a new empty project from scratch and doing everything manually.

My system is running on W10 OS and my c++ IDE is MS VS 2017. The link to github source code is: https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/greeter_server.cc

I am able to use protoc.exe on the protocol buffer format file in this link: https://github.com/grpc/grpc/blob/master/examples/protos/helloworld.proto

It generates two .h and two .cc (for both pb and grpc) that I copy in the same folder than the greeter_server.cc project.

gRPC discourages the use of dynamic libraries, so I will use static linking. My installation directory is in c:/vcpg/installed/x86-windows and has the normal include, lib and bin folder of any project, along with a tools folder containing grpc plugins, openssl and protobuf.

I tried to link with grpc.lib and grpc++.lib just dragging them into the project for static linking, but when I compile, I just got hundreds of linker errors. I also try to just add the rest of .lib in the lib folder, but the linker keeps complaining.

I don't know what else to do. Does someone know how to get gRPC working in VS 2017 without using CMake, just telling me what libraries,static or dynamic, are needed?

Thanks a lot

tobias.krueger

unread,
Feb 25, 2021, 1:26:29 AMFeb 25
to grpc.io
Hi Pablo,
building gRPC itself without CMake or Bazel would be quite hard.
But if you are using the vcpkg it should be no problem to build projects just with Visual Studio. 

Currently I am shifting to a home-brew dynamic build of GRPC but before this I used also the static libs coming from a nuget package inside a normal Visual studio solution..
I just took a look at my Hello World solution and I see the following libs referenced:

gpr.lib
grpc++.lib
grpc++_cronet.lib
grpc.lib
libeay32.lib
libprotobuf-lite.lib
ssleay32.lib
zlib.lib

If this does not help you should post here your linker errors - nut just "hundreds of".

Best regards
Tobias
Reply all
Reply to author
Forward
0 new messages