在尝试用make all在c++中编译Mesosphere的RENDLER后,我收到以下错误:
$ make all
g++  -g -O2 -pthread -o rendler rendler.cpp -lmesos -lpthread -lprotobuf
In file included from /usr/local/include/stout/stringify.hpp:26:0,
                 from /usr/local/include/stout/bytes.hpp:26,
                 from /usr/local/include/mesos/resources.hpp:29,
                 from rendler.cpp:30:
/usr/local/include/stout/hashmap.hpp:43:32: error: expected ‘)’ before ‘<’ token
   hashmap(std::initializer_list<std::pair<Key, Value>> list)
                                ^
rendler.cpp:345:1: error: expected ‘}’ at end of input
 }
 ^
In file included from /usr/local/include/stout/stringify.hpp:26:0,
                 from /usr/local/include/stout/bytes.hpp:26,
                 from /usr/local/include/mesos/resources.hpp:29,
                 from rendler.cpp:30:
/usr/local/include/stout/hashmap.hpp:40:14: error: expected unqualified-id at end of input
   hashmap() {}
              ^
make: *** [rendler] Error 1我已经在正确的包含路径中安装了所有列出的依赖项以及相关的第三方库。在尝试编译mesos/src/examples目录中的示例框架时,我收到了相同的错误。是什么导致了这个错误?
发布于 2015-05-23 01:18:59
这段代码
     std::initializer_list<std::pair<Key, Value>>
  // ^^^^^^^^^^^^^^^^^^^^^导致错误
 error: expected ‘)’ before ‘<’ token对于标准版c++11编译器,因为std::initializer_list最早是随c++11一起引入的。
像GCC这样的大多数最新的编译器都允许设置-std=c++11选项,这应该可以修复您的错误。
https://stackoverflow.com/questions/30402300
复制相似问题