Recently to learn Protobuf's protocol generation, you need to download its code from the Web, download it from this SVN address:
Http://protobuf.googlecode.com/svn/trunk
After the download is complete, you can find the VC2008 project file in the Protobuf\vsprojects directory, and then open the project for conversion, this is no problem. However, there are two problems in the compilation process, the first of which is as follows:
1>------Build Started:Project:gtest_main, Configuration:debug Win32------
1> gtest_main.cc
1>e:\protobuf\gtest\include\gtest\gtest-printers.h (556): Error C2977: ' std::tuple ': too many template arguments
1> C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\include\utility (in): See Declaration of ' Std::tuple '
1>e:\my\git\protobuf\gtest\include\gtest\gtest-printers.h (564): Error C2977: ' std::tuple ': too many template Arguments
1> C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\include\utility (in): See Declaration of ' Std::tuple '
In this case, because of the use of std::tuple, and the number of uses reached 10, so the compilation prompt above the error. Only need to put STD;; The number in a tuple is defined as 10. An easier way is to open Solution Explorer, right-click on the Project "Properties", and add the following lines in C/s + +----and "preprocessor"--"preprocessing definitions":
_variadic_max=10
In VC2012 _variadic_max is defined as 5 by default, so more than 5 parameter inputs are not supported, resulting in an error. Of course, after this modification, the compilation will occupy a little more memory.
The second problem is as follows:
3>------Build started:project:lite-test, Configuration:debug Win32------
2>test_plugin.obj:warning lnk4075:ignoring '/editandcontinue ' due to '/SAFESEH ' specification
2>gtestd.lib (gtest-all.obj): Error Lnk2038:mismatch detected for ' runtimelibrary ': value ' mtd_staticdebug ' doesn ' t m Atch value ' Mdd_dynamicdebug ' in Test_plugin.obj
3> Lite-test.vcxproj-E:\protobuf\vsprojects\Debug\lite-test.exe
2>msvcprtd.lib (MSVCP110D.dll): Error LNK2005: "Public: __thiscall std::_container_base12::_container_base12 (void )" (?? 0_container_base12@std@ @QAE @xz) already defined in Gtestd.lib (gtest-all.obj)
This problem occurs because the project is in the process of conversion, there will be some projects using the MD compilation option, and some projects use the MTD compilation option, causing static and dynamic connection msvc to conflict with the connection library. The default all engineering changes MT or MTD compilation, which can be resolved.