I'm on day three of trying to get a "simple" grpc application going but have hit the 15th roadblock.
So far I've:
- Managed to build and install GRPC using the instructions here https://github.com/grpc/grpc/blob/master/BUILDING.md#windows-using-visual-studio-2019-or-later which resulted in me having GRPC installed to
C:\libs\grpc\grpc
- Generated my
.ccand.hfiles usingprotocand added them to my project
- Added the GRPC install directory to the
IncludeandLibrarydirectories
However when I try to build my application I'm bombarded with errors related to unresolved external symbols

From my understanding of the error, I'm not linking to something that contains each of the symbols missing however given I've
Its been a long time since I've touched c++ so appologies if this is a simple issue
After some more messing around I managed to get things working. @sweenish got me on the right track with suggesting using cmake and pointing me to https://github.com/grpc/grpc/tree/master/src/cpp however I did still need to build from source (which given https://grpc.io/docs/languages/cpp/quickstart/ starts with building GRPC from source, I believe is the intended way to go.)
Given I found so little useful info on how to end-to-end get a basic c++ GRPC app running, I figured I'd answer my question with a step by step of how to get things working so the next person has an easier time.
Building GRPC on Windows
These steps are similar to those mentioned in https://grpc.io/docs/languages/cpp/quickstart/ however they will be targeting Windows
C:\libs.git clone --recurse-submodules -b v1.60.0 --depth 1 --shallow-submodules https://github.com/grpc/grpccdinto thegrpc/cmakedirectory. Make a new directory calledbuildand cd into it. You should now be ingrpc/cmake/buildwheregrpcis the root directory of the repo you clonedcmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF "-DCMAKE_INSTALL_PREFIX=C:/libs" ../... Note the file path/is the worng way around for Windows (no idea if this matters but it works)cmake --build . --config Release- Go make a coffee, even on a high end machine this can take upwards of 30 mins. You may have some luck withcmake --build . --config Release -- /mspeeding things upcmake --install . --config Release--config DebugIf everything worked, GRPC should be installed in your directory of choice. An easy way to check is to go to
[INSTALL_DIR]\binand runprotoc.exe --version, if you get something likelibprotoc 25.0then you've successfully built GRPC for Windows.Compiling Applications with GRPC on WIndows
Compiling GRPC is half the battle, now we need to build an app that uses it to confirm everything is working. A good test is the
HelloWorldapp that comes as part of the repo you checked out in the previous step located atgrpc\examples\cpp\helloworld. I'll go through both commandline and Visual Studio building as they are slightly different.Command Line
grpc\examples\cpp\helloworldcmake "-DCMAKE_PREFIX_PATH=C:/libs" .. Make sure you replaceC:/libswith your install locationcmake --build . --config ReleaseThe output directory structure is a bit of a mess but you should now have a helloworld server and client application at the following locations. Give them both a run to confirm everything is working
grpc\examples\cpp\helloworld\Release\greeter_server.exegrpc\examples\cpp\helloworld\Release\greeter_client.exeVisual Studio 2022
Not sure if its needed but I'll mention it just incase, In Visual Studio Installer I have the default options for
Desktop development with C++installed which includesC++ CMake tools for Windows.Open a local foldergrpc\examples\cpp\helloworldx64-Debug) and selectManage Configurations...CMake command argumentssection add"-DCMAKE_PREFIX_PATH=C:/libs"(including the quotes)Hopefully all that helps someone oneday, time to start actually using GRPC with C++!