Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 398 by mjkl...@gmail.com: Compiler Errors in VS2012 - With some solutions
http://code.google.com/p/protobuf/issues/detail?id=398

What steps will reproduce the problem?
1. Open the project files in VS2012 (allow the automatic conversion)
2. Compile Solution
3. Compilation Errors (with most projects - in particular test projects)

What is the expected output? What do you see instead?

Well, no compilation errors...

What version of the product are you using? On what operating system?

I tried with :
 - protobuf 2.4.1 zip
 - protobuf from trunk - using gtest 1.5 as by default
- protobuf from trunk - using gtest 1.6 (after having changed the sn:external property to try if that change something)



Please provide any additional information below.

I tried this in VS2012 RC and it appear that there are mainly 2 problems:

1. Google Test will use std::tr1::tuple with about 10 arguments, but in VS2012 they had to reduce the default template argument number of std::tuple because they don't implement tuple correctly yet and it is only pregenerated. I think the arguments are about 5. To fix this here is what I have in my CMakeFiles.txt of a project that use Google Test:

if( MSVC ) # VS2012 doesn't support correctly the tuples yet
        add_definitions( /D _VARIADIC_MAX=10 )
endif()

add_subdirectory( googletest )


That way I can compile gtest fine.

2. In src\google\protobuf\compiler\command_line_interface.cc line 913 we have:

proto_path_.push_back(make_pair<std::string, std::string>(virtual_path, disk_path));

Ther is a very strange compiler error saying that this instance of make_pair is not compatible with the arguments, while virtual_path and disk_path are both std::string...

The easy and in some way "more" correct way to fix this is to remove the arguments (that will be automatically found and also that still apparently match the push_back requirements):

    proto_path_.push_back(make_pair(virtual_path, disk_path));

I can compile protoc once this modification is applied.




--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to