错误:未在此范围内声明'deprecated'

时间:2017-07-10 19:44:04

标签: c++11 g++

我将程序更新为--std = c ++ 11,现在我得到了:

g++ --std=c++11 -c eqc.cpp
In file included from eqc.cpp:16:0:
eqc.h:372:80: error: ‘deprecated’ was not declared in this scope
eqc.h:372:92: error: expected ‘)’ before ‘;’ token
eqc.h:372:92: error: expected ‘)’ before ‘;’ token
In file included from eqc.cpp:16:0:
eqc.h:372:74: error: expected unqualified-id before ‘)’ token
 equation &operator[](const std::string &label) __attribute__((deprecated));

如果我使用指定属性的新方法,它是相同的:

In file included from eqc.cpp:16:0:
eqc.h:371:67: error: ‘deprecated’ was not declared in this scope
eqc.h:371:79: error: expected ‘]’ before ‘;’ token
In file included from eqc.cpp:16:0:
eqc.h:371:61: error: expected unqualified-id before ‘]’ token
   equation &operator[](const std::string &label) [[deprecated]];

由于我在网上找不到关于这个错误的任何内容,我必须犯一些愚蠢的错误。但是哪个?

系统是Ubuntu 16.04和编译器: g ++(Ubuntu 5.4.0-6ubuntu1~16.04.4)5.4.0 20160609

1 个答案:

答案 0 :(得分:1)

问题是库(libginac6 1.7.0)说

#define deprecated attribute ((deprecated));

更新库后(版本> = 1.7.1)错误消失,因为库现在说

#define attribute_deprecated attribute ((deprecated));