在网站 http://code.google.com/p/protobuf/downloads/list上可以下载 Protobuf 的源代码。然后解压编译安装便可以使用它了。
使用2.4.1版本,
源代码目录下vsprojects/libprotobuf-lite.vcproj,以及自己整理的lite工程,
(1):Create a Win32 Smart Device Project library project, name it protobuf-lite-ce
(2):Copy all source files from protobuf-lite project to protobuf-lite-ce project in Solution Explorer
(3):Create a ce_port folder in the project's directory, and copy the errno.h header file from (Visual_Studio_Root)/VC/include into the folder. This is because Windows CE doesn't have this file, so we need to provide one. Actually, this errno.h can be a pure empty file.
(4):Add "../src;.;./ce_port" to the project's Additional Include Directories.
(5):The windef.h header file already defines OPTIONAL macro, it conflicts with Cardinality::OPTIONAL enum. So theextension_set.cc fails to compile, to solve this, add following code before enum Cardinality definition to undefine OPTIONAL:
#if defined(OPTIONAL)
#if defined(_MSC_VER)
#pragma message ("Unexpected OPTIONAL macro definition, #undefine OPTIONAL")
#else
#warning "Unexpected OPTIONAL macro definition, #undefine OPTIONAL"
#endif
#undef OPTIONAL
#endif
namespace {
enum Cardinality {
REPEATED,
OPTIONAL
};
} // namespace
使用Protobuf 2.4.1在Windows CE环境下的配置与优化

本文详细介绍了如何在Windows CE环境下配置并优化使用Protobuf 2.4.1的过程,包括创建Win32智能设备项目库、复制源代码文件、提供缺少的errno.h头文件、设置额外包含目录以及解决宏冲突等步骤。

被折叠的 条评论
为什么被折叠?



