中间层rendler编译错误

unhi4e5o  于 2021-06-21  发布在  Mesos
关注(0)|答案(1)|浏览(264)

在尝试用c++编译中间层的rendler之后 make all ,我收到以下错误:

$ 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

我已经在正确的include路径中安装了所有列出的依赖项以及相关的第三方库。在尝试编译中的示例框架时,我收到了相同的错误 mesos/src/examples 目录。是什么导致了这个错误?

i5desfxk

i5desfxk1#

这段代码

std::initializer_list<std::pair<Key, Value>>
  // ^^^^^^^^^^^^^^^^^^^^^

导致错误

error: expected ‘)’ before ‘<’ token

对于前标准c11编译器,自 std::initializer_list 最早是用c11引入的。
大多数像gcc这样的最新编译器都允许设置 -std=c++11 选项,该选项将修复错误。

相关问题