VC 2012 Compiler protobuf error handling

Source: Internet
Author: User
Tags definition error handling include svn win32 visual studio

To learn about Protobuf's protocol generation, you'll need to download its code from the Web and download it from this SVN address:

Http://protobuf.googlecode.com/svn/trunk

After the download is complete, you can go to the Protobuf\vsprojects directory to find the VC2008 project file, 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

1> C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\include\utility (The): "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 (The): "Declaration of Std::tuple"

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/vc/

Here because of the use of std::tuple, and the number of uses reached 10, so the compilation prompts the error above. Only need to put STD;; The number in the tuple is defined as 10. An easier way to do this is to open Solution Explorer, right-click the project properties, and add the following lines to the--> preprocessor--> preprocessor Definition:

_variadic_max=10

The default definition of _variadic_max in VC2012 is 5, so it does not support more than 5 parameter inputs, resulting in an error. Of course, after this modification, the compilation will occupy a little more memory.

The second question 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)

The reason for this problem is that engineering in the conversion process, there will be some engineering using the MD compilation options, some engineering using MTD compilation options, resulting in static and dynamic connection Msvc Connection library conflict. Default all engineering changes MT or MTD compiles, that can be resolved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.