- 博客(6)
- 收藏
- 关注
原创 回调函数--送女朋友回家
背景: 男朋友送女朋友回家,让女朋友到家给男朋友发短信 执行: void 回家(发短信) { 发短信(); cout<<"在回家的路上走啊走啊走"<<endl; } void 发短信() { cout<<"给男朋友发短信:我到家了"<<endl; } //执行回调函数 回家(发短信); 回调函数的定义: 回调函数就是一个...
2019-11-15 11:09:26
219
原创 protobuf3在Windows下的下载、编译和使用
准备工作: 1.全程使用的电脑为公司的win10 64位旗舰版,已经预先安装VS2013和cmake3.15.4,需要注意的是,如果cmake版本过低,编译时会提示失败,需要更新的cmake版本,重新执行操作。 2.下载protobuf源代码,公司内网可以访问github,因此选择从github直接下载ZIP包:protobuf-3.0.2.zip,这里解压到 “D:\develop”。 编译: ...
2019-11-13 11:16:38
2339
原创 protobuf在windows环境下的使用
对protoc文件在cmd的编译命令如下: protoc -I=C:\Users\98795\protobuf-2.6.1\examples --cpp_out=C:\Users\98795\protobuf-2.6.1\examples C:\Users\98795\protobuf-2.6.1\examples\protobuf_test.proto 如图: ...
2019-10-14 14:07:54
181
原创 使用protobuf和socket实现服务器间消息的传递
传递的消息是简单的char*的话,客户端和服务器端以及protoc文件分别如下: //.protoc文件,包含的信息是身份证号,姓名和生日 package tutorial; message Person { required string id = 1; required string name = 2; required int32 birthyear=3; required i...
2019-10-12 10:30:35
937
原创 Windows下利用c/c++语言测试函数运行时间
在Windows下计算函数的运行时间的计算方法,计算结果单位为毫秒 //计时开始 LARGE_INTEGER freq, freqcnt; double dcnt, cnt1, cnt2; QueryPerformanceFrequency(&freq); dcnt = freq.QuadPart; QueryPerformanceCounter(&freqcnt); cnt1...
2019-10-09 15:41:36
405
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅