rpcz VC2010 构建
来源:互联网 发布:淘宝刷单小号哪里买 编辑:程序博客网 时间:2024/06/08 13:15
rpcz VC2010 构建
CMake Error at D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1192 (message):
Unable to find the requested Boost libraries.
如果找不到boost_thread库,添加
SET(Boost_USE_STATIC_LIBS TRUE)
因为Windows下Boost默认是不生成动态库的。
Required library ZeroMQ NOT FOUND.
Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
可手工在cmake-gui中设置ZeroMQ的INCLUDE_DIR和LIBRARY, 以及protobuf的源码目录.
CMake生成sln后, 用VC打开, 构建.
cl : Command line error D8021: invalid numeric argument '/Wextra'
将gcc编译参数用if包括:
+if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Werror")
+endif(CMAKE_COMPILER_IS_GNUCXX)
application.cc(18): fatal error C1083: Cannot open include file: 'zmq.hpp': No such file or directory
需要设置 cppzmq 目录.
添加CPPZMQ_DIR.
或者直接 include_directories(E:/JinQing/Src/cppzmq)
src\rpcz/rpcz.pb.h(293): error C2059: syntax error : 'constant'
生成的代码 NO_ERROR 与VC Error.h 中的 define 冲突.
改为 APPLICATION_NO_ERROR 常量,不会与宏冲突。
clock.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\clock.cc(18): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
将gettimeofday()改为:
return boost::chrono::high_resolution_clock().now().time_since_epoch().count / 1000000;
connection_manager.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\connection_manager.cc(25): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
DELETE
connection_manager.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\connection_manager.cc(28): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
改为:
#ifdef WIN32
#include <process.h> // for getpid()
#else
#include <unistd.h> // for getpid()
#endif
..\..\..\..\LibSrc\rpcz\src\rpcz\reactor.cc(122): error C2079: 'action' uses undefined struct 'rpcz::install_signal_handler::sigaction'
..\..\..\..\LibSrc\rpcz\src\rpcz\reactor.cc(125): error C3861: 'sigemptyset': identifier not found
改为:
void install_signal_handler() {
#ifdef WIN32
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
#else
struct sigaction action;
action.sa_handler = signal_handler;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
#endif // WIN32
}
server.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\server.cc(20): fatal error C1083: Cannot open include file: 'sys/errno.h': No such file or directory
DELETE
zmq_utils.cc
D:/LibSrc/rpcz/include\rpcz/zmq_utils.hpp(58): error C2146: syntax error : missing ';' before identifier 'has_more_'
改为int
------ Build started: Project: rpcz, Configuration: Release Win32 ------
LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_53.lib'
Add lib dir.
3>------ Build started: Project: zsendrpc, Configuration: Debug Win32 ------
3> zsendrpc.cc
3>LINK : fatal error LNK1104: cannot open file 'Debug\rpcz.lib'
仅生成rpcz.dll, 没有lib. 因为没有export.
应该生成静态库.
开启 rpcz_build_static
并且让zsendrpc在rpcz.lib之后编译:
rpcz 是应用ZeroMQ和Protobuf开发的RPC.
见: https://github.com/reinferio/rpcz
及 https://code.google.com/p/rpcz/
CMake Error at D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1192 (message):
Unable to find the requested Boost libraries.
如果找不到boost_thread库,添加
SET(Boost_USE_STATIC_LIBS TRUE)
因为Windows下Boost默认是不生成动态库的。
Required library ZeroMQ NOT FOUND.
Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
可手工在cmake-gui中设置ZeroMQ的INCLUDE_DIR和LIBRARY, 以及protobuf的源码目录.
CMake生成sln后, 用VC打开, 构建.
cl : Command line error D8021: invalid numeric argument '/Wextra'
将gcc编译参数用if包括:
+if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Werror")
+endif(CMAKE_COMPILER_IS_GNUCXX)
application.cc(18): fatal error C1083: Cannot open include file: 'zmq.hpp': No such file or directory
需要设置 cppzmq 目录.
添加CPPZMQ_DIR.
或者直接 include_directories(E:/JinQing/Src/cppzmq)
src\rpcz/rpcz.pb.h(293): error C2059: syntax error : 'constant'
生成的代码 NO_ERROR 与VC Error.h 中的 define 冲突.
改为 APPLICATION_NO_ERROR 常量,不会与宏冲突。
clock.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\clock.cc(18): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
将gettimeofday()改为:
return boost::chrono::high_resolution_clock().now().time_since_epoch().count / 1000000;
connection_manager.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\connection_manager.cc(25): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
DELETE
connection_manager.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\connection_manager.cc(28): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
改为:
#ifdef WIN32
#include <process.h> // for getpid()
#else
#include <unistd.h> // for getpid()
#endif
..\..\..\..\LibSrc\rpcz\src\rpcz\reactor.cc(122): error C2079: 'action' uses undefined struct 'rpcz::install_signal_handler::sigaction'
..\..\..\..\LibSrc\rpcz\src\rpcz\reactor.cc(125): error C3861: 'sigemptyset': identifier not found
改为:
void install_signal_handler() {
#ifdef WIN32
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
#else
struct sigaction action;
action.sa_handler = signal_handler;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
#endif // WIN32
}
server.cc
..\..\..\..\LibSrc\rpcz\src\rpcz\server.cc(20): fatal error C1083: Cannot open include file: 'sys/errno.h': No such file or directory
DELETE
zmq_utils.cc
D:/LibSrc/rpcz/include\rpcz/zmq_utils.hpp(58): error C2146: syntax error : missing ';' before identifier 'has_more_'
改为int
------ Build started: Project: rpcz, Configuration: Release Win32 ------
LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_53.lib'
Add lib dir.
3>------ Build started: Project: zsendrpc, Configuration: Debug Win32 ------
3> zsendrpc.cc
3>LINK : fatal error LNK1104: cannot open file 'Debug\rpcz.lib'
仅生成rpcz.dll, 没有lib. 因为没有export.
应该生成静态库.
开启 rpcz_build_static
并且让zsendrpc在rpcz.lib之后编译:
add_dependencies(zsendrpc rpcz_static) # zsendrpc need rpcz.lib
修改后的代码见:
https://github.com/jinq0123/rpcz
- rpcz VC2010 构建
- vc2010
- 在VC2010内使用CBrush构建透明笔刷
- 如何运行 rpcz python example
- RPCZ中的智能指针单例
- VC2010 + TFS2010 结合 Boost.Test 库进行自动化构建及自动化测试
- VC2010 GDI+
- vc2010快捷键
- vc98 -> vc2010
- windows vc2010
- VC2010快捷
- VC2010 配置OpenGL环境
- vc2010 新特性演示
- vc2010调用存储过程
- vc2010导入DLL库
- VC2010加快速度
- VC2010 lambda sample
- vc2010 使用boost
- 深入研究java.lang.ThreadLocal类
- c语言学习2
- 关于TOMCAT常见问题及解决的摘录
- 链表基本操作的实现
- Best Practices for performence - Managing your app's memory
- rpcz VC2010 构建
- 激活SEAndroid(六)
- Java 多线程 (并发)总结
- SnowNLP:处理中文文本内容
- 3D电影,左右格式转红蓝格式
- 与opengl相关代码
- ICG技术专栏---互联网应用如何穿越NAT
- c++ vector erase删除元素
- 与Android camera相关代码