This directory contains project files for compiling Protocol Buffers using
MSVC. This is not the recommended way to do Protocol Buffer development --
we prefer to develop under a Unix-like environment -- but it may be more
accessible to those who primarily work with MSVC.
Compiling and Installing
========================
1) Open protobuf.sln in Microsoft Visual Studio.
2) Choose "Debug" or "Release" configuration as desired.*
3) From the Build menu, choose "Build Solution". Wait for compiling to finish.
4) From a command shell, run tests.exe and lite-test.exe and check that all
tests pass.
5) Run extract_includes.bat to copy all the public headers into a separate
"include" directory (under the top-level package directory).
6) Copy the contents of the include directory to wherever you want to put
headers.
7) Copy protoc.exe wherever you put build tools (probably somewhere in your
PATH).
8) Copy libprotobuf.lib, libprotobuf-lite.lib, and libprotoc.lib wherever you
put libraries.
* To avoid conflicts between the MSVC debug and release runtime libraries, when
compiling a debug build of your application, you may need to link against a
debug build of libprotobuf.lib. Similarly, release builds should link against
release libs.
DLLs vs. static linking
=======================
Static linking is now the default for the Protocol Buffer libraries. Due to
issues with Win32's use of a separate heap for each DLL, as well as binary
compatibility issues between different versions of MSVC's STL library, it is
recommended that you use static linkage only. However, it is possible to
build libprotobuf and libprotoc as DLLs if you really want. To do this,
do the following:
1) Open protobuf.sln in MSVC.
2) For each of the projects libprotobuf, libprotobuf-lite, and libprotoc, do
the following:
2a) Right-click the project and choose "properties".
2b) From the side bar, choose "General", under "Configuration Properties".
2c) Change the "Configuration Type" to "Dynamic Library (.dll)".
2d) From the side bar, choose "Preprocessor", under "C/C++".
2e) Add PROTOBUF_USE_DLLS to the list of preprocessor defines.
3) When compiling your project, make sure to #define PROTOBUF_USE_DLLS.
When distributing your software to end users, we strongly recommend that you
do NOT install libprotobuf.dll or libprotoc.dll to any shared location.
Instead, keep these libraries next to your binaries, in your application's
own install directory. C++ makes it very difficult to maintain binary
compatibility between releases, so it is likely that future versions of these
libraries will *not* be usable as drop-in replacements.
If your project is itself a DLL intended for use by third-party software, we
recommend that you do NOT expose protocol buffer objects in your library's
public interface, and that you statically link protocol buffers into your
library.
ZLib support
============
If you want to include GzipInputStream and GzipOutputStream
(google/protobuf/io/gzip_stream.h) in libprotoc, you will need to do a few
additional steps:
1) Obtain a copy of the zlib library. The pre-compiled DLL at zlib.net works.
2) Make sure zlib's two headers are in your include path and that the .lib file
is in your library path. You could place all three files directly into the
vsproject directory to compile libprotobuf, but they need to be visible to
your own project as well, so you should probably just put them into the
VC shared icnlude and library directories.
3) Right-click on the "tests" project and choose "properties". Navigate the
sidebar to "Configuration Properties" -> "Linker" -> "Input".
4) Under "Additional Dependencies", add the name of the zlib .lib file (e.g.
zdll.lib). Make sure to update both the Debug and Release configurations.
5) If you are compiling libprotobuf and libprotoc as DLLs (see previous
section), repeat steps 2 and 3 for the libprotobuf and libprotoc projects.
If you are compiling them as static libraries, then you will need to link
against the zlib library directly from your own app.
6) Edit config.h (in the vsprojects directory) and un-comment the line that
#defines HAVE_ZLIB. (Or, alternatively, define this macro via the project
settings.)
Notes on Compiler Warnings
==========================
The following warnings have been disabled while building the protobuf libraries
and compiler. You may have to disable some of them in your own project as
well, or live with them.
C4018 - 'expression' : signed/unsigned mismatch
C4146 - unary minus operator applied to unsigned type, result still unsigned
C4244 - Conversion from 'type1' to 'type2', possible loss of data.
C4251 - 'identifier' : class 'type' needs to have dll-interface to be used by
clients of class 'type2'
C4267 - Conversion from 'size_t' to 'type', possible loss of data.
C4305 - 'identifier' : truncation from 'type1' to 'type2'
C4355 - 'this' : used in base member initializer list
C4800 - 'type' : forcing value to bool 'true' or 'false' (performance warning)
C4996 - 'function': was declared deprecated
C4251 is of particular note, if you are compiling the Protocol Buffer library
as a DLL (see previous section). The protocol buffer library uses templates in
its public interfaces. MSVC does not provide any reasonable way to export
template classes from a DLL. However, in practice, it appears that exporting
templates is not necessary anyway. Since the complete definition of any
template is available in the header files, anyone importing the DLL will just
end up compiling instances of the templates into their own binary. The
Protocol Buffer implementation does not rely on static template members being
unique, so there should be no problem with this, but MSVC prints warning
nevertheless. So, we disable it. Unfortunately, this warning will also be
produced when compiling code which merely uses protocol buffers, meaning you
may have to disable it in your code too.
没有合适的资源?快使用搜索试试~ 我知道了~
protobuf 2.5源码包
共593个文件
cc:183个
h:124个
java:77个
5星 · 超过95%的资源 需积分: 35 19 下载量 102 浏览量
2014-06-20
16:11:55
上传
评论
收藏 2.91MB ZIP 举报
温馨提示
google protobuf 2.5 src pack,强大的墙让人下载起来很麻烦,共享给大家,方便开发工作
资源推荐
资源详情
资源评论
收起资源包目录
protobuf 2.5源码包 (593个子文件)
configure.ac 5KB
configure.ac 3KB
Makefile.am 21KB
Makefile.am 15KB
Makefile.am 9KB
extract_includes.bat 4KB
gtest.cbproj 10KB
gtest_unittest.cbproj 9KB
gtest_main.cbproj 8KB
gtest-all.cc 334KB
descriptor.pb.cc 285KB
gtest_unittest.cc 227KB
descriptor.cc 183KB
gtest.cc 174KB
descriptor_unittest.cc 167KB
test_util.cc 166KB
test_util_lite.cc 87KB
parser_unittest.cc 79KB
gtest_pred_impl_unittest.cc 76KB
cpp_message.cc 64KB
extension_set.cc 58KB
python-proto2.cc 58KB
parser.cc 52KB
gtest-death-test.cc 49KB
command_line_interface_unittest.cc 49KB
text_format.cc 49KB
java_message.cc 48KB
generated_message_reflection.cc 48KB
gtest-printers_test.cc 48KB
cpp_unittest.cc 48KB
command_line_interface.cc 48KB
text_format_unittest.cc 44KB
python_generator.cc 43KB
gtest-death-test_test.cc 42KB
strutil.cc 42KB
coded_stream_unittest.cc 40KB
repeated_field_unittest.cc 39KB
wire_format.cc 38KB
gtest-port_test.cc 38KB
plugin.pb.cc 38KB
tokenizer_unittest.cc 37KB
tokenizer.cc 35KB
java_message_field.cc 33KB
wire_format_unittest.cc 33KB
gtest-param-test_test.cc 32KB
gtest_output_test_.cc 32KB
extension_set_unittest.cc 30KB
zero_copy_stream_unittest.cc 28KB
java_primitive_field.cc 27KB
gtest-port.cc 27KB
coded_stream.cc 27KB
extension_set_heavy.cc 26KB
java_string_field.cc 26KB
type_traits_unittest.cc 24KB
gtest-filepath_test.cc 23KB
descriptor_database_unittest.cc 23KB
structurally_valid.cc 22KB
cpp_file.cc 22KB
unknown_field_set_unittest.cc 22KB
java_enum_field.cc 21KB
dynamic_message.cc 20KB
importer_unittest.cc 19KB
generated_message_reflection_unittest.cc 18KB
descriptor_database.cc 18KB
cpp_string_field.cc 18KB
java_file.cc 18KB
cpp_helpers.cc 16KB
importer.cc 16KB
java_helpers.cc 15KB
java_service.cc 15KB
reflection_ops_unittest.cc 14KB
cpp_primitive_field.cc 14KB
gtest-filepath.cc 14KB
subprocess.cc 14KB
wire_format_lite.cc 14KB
cpp_enum_field.cc 13KB
gtest-unittest-api_test.cc 13KB
message_lite.cc 13KB
message.cc 12KB
cpp_service.cc 12KB
zero_copy_stream_impl.cc 12KB
gtest-printers.cc 12KB
python_descriptor.cc 12KB
common.cc 12KB
gtest-typed-test_test.cc 11KB
message_unittest.cc 11KB
zero_copy_stream_impl_lite.cc 11KB
cpp_message_field.cc 10KB
zip_writer.cc 10KB
common_unittest.cc 10KB
gzip_stream.cc 10KB
gtest-listener_test.cc 10KB
gtest_stress_test.cc 9KB
java_enum.cc 9KB
gtest-tuple_test.cc 9KB
reflection_ops.cc 9KB
cpp_enum.cc 9KB
mock_code_generator.cc 9KB
sample6_unittest.cc 9KB
gtest_catch_exceptions_test_.cc 9KB
共 593 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- 夜读成才2014-06-24很好,可以使用。protobuf可是好东西啊
niushi0159
- 粉丝: 5
- 资源: 42
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功