-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to build helloworld server code #55
Comments
Your example uses Boost.Asio, to make it use standalone Asio instead you will have to make some changes: - 18 #include <boost/asio/co_spawn.hpp>
- 19 #include <boost/asio/detached.hpp>
- 20 #include <boost/asio/signal_set.hpp>
+ 18 #include <asio/co_spawn.hpp>
+ 19 #include <asio/detached.hpp> - 26 namespace asio = boost::asio; And of course the request that you actually want to handle. This comes from your zprobe.proto. In other words, these lines should be adjusted: helloworld::HelloRequest request;
grpc::ServerAsyncResponseWriter<helloworld::HelloReply> writer{&server_context};
co_await agrpc::request(&helloworld::Greeter::AsyncService::RequestSayHello, service, server_context,
request, writer, asio::use_awaitable);
helloworld::HelloReply response;
response.set_message("Hello " + request.name()); You should also be able to simplify your CMake file: target_link_libraries(zprobe
PUBLIC zprobe_grpc_proto
asio-grpc::asio-grpc-standalone-asio) |
The following is the error after I follow above. I added following to CMakeLists.txt
Then I get the following error.
|
I have created a minimal version of the helloworld example with standalone Asio and vcpkg here: https://github.com/Tradias/example-vcpkg-grpc/tree/asio-grpc-55. I hope that helps. |
@Tradias I think the example repo does not use ASIO? |
It uses standalone ASIO, just like in your code :), see https://github.com/Tradias/example-vcpkg-grpc/blob/asio-grpc-55/src/main.cpp |
Thanks @Tradias. It worked. |
I tried extensively with following code. Get compilation error as in this post.
any help is appreciated. Thanks you @Tradias
Code
ERROR on make
The text was updated successfully, but these errors were encountered: