Hello folks,
Protobuf 2.4.1 fails to build using gcc 4.7.0 (on CentOS 6.2) with the
C++11 standard enabled (-std=c++11). The error is shown at the end. The fix
is simple though:
*snip*
--- protobuf-2.4.1/src/google/protobuf/compiler/command_line_interface.cc
2012-04-19
22:20:07.426070065 +0100
+++ protobuf-2.4.1/src/google/protobuf/compiler/command_line_interface.cc
2012-04-19
22:20:20.351925288 +0100
@@ -910,7 +910,7 @@
cerr << disk_path << ": warning: directory does not exist." <<
endl;
}
- proto_path_.push_back(make_pair<string, string>(virtual_path,
disk_path));
+ proto_path_.push_back(make_pair(virtual_path, disk_path));
}
} else if (name == "-o" || name == "--descriptor_set_out") {
*snip*
Without this fix the error is:
libtool: compile: g++-4.7.0 -DHAVE_CONFIG_H -I. -I.. -pthread -Wall
-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -std=c++11 -MT
plugin.lo -MD -MP -MF .deps/plugin.Tpo -c
google/protobuf/compiler/plugin.cc -fPIC -DPIC -o .libs/plugin.o
google/protobuf/compiler/command_line_interface.cc: In member function
‘bool
google::protobuf::compiler::CommandLineInterface::InterpretArgument(const
string&, const string&)’:
google/protobuf/compiler/command_line_interface.cc:913:78: error: no
matching function for call to ‘make_pair(std::string&, std::string&)’
google/protobuf/compiler/command_line_interface.cc:913:78: note: candidate
is:
In file included from
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:65:0,
from
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/char_traits.h:41,
from
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/string:42,
from ./google/protobuf/stubs/common.h:41,
from
./google/protobuf/compiler/command_line_interface.h:41,
from google/protobuf/compiler/command_line_interface.cc:35:
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:274:5:
note: template<class _T1, class _T2> constexpr std::pair<typename
std::__decay_and_strip<_T1>::__type, typename
std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:274:5:
note: template argument deduction/substitution failed:
google/protobuf/compiler/command_line_interface.cc:913:78: note: cannot
convert ‘virtual_path’ (type ‘std::string {aka std::basic_string<char>}’)
to type ‘std::basic_string<char>&&’
Can we get this into the next release?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/protobuf/-/_cf6a7cyH2kJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.