承接之前grpc的编译成功之后,接下来就是使用grpc库了,很简单,我们先将grpc的hello world例子跑成功,这样就可以正式引入使用了。
但是事情总是不会那么简单就成功的,解决了很多闹心的问题之后,我在QtCreator中尝试运行hello world,代码大家自己改一改
我实在自己的项目中用,所有就将hello world中的main给干掉了,然后加入到我自己的项目中去,很简单,能跑通就行,之后的事情再去弄就行了。记得看到最底下,有完整例子,国外一小伙写的,我还没编译运行,大家自己尝试吧。
某xxx.cpp文件:
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and