C++ 什么是“从这里需要”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14779839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is 'required from here' error
提问by Etherealone
It is in my Eclipse Problems view. The code compiles fine but there is an error saying "required from here
", pointing to some boost header file and to the line state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
它在我的 Eclipse 问题视图中。代码编译得很好,但有一个错误说“ required from here
”,指向一些 boost 头文件和行state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
I don't like to have errors or warnings. Does anybody know what that is?
我不喜欢有错误或警告。有人知道那是什么吗?
采纳答案by gnod
This behavior is a bug of eclipse CDT Error Parser: https://bugs.eclipse.org/bugs/show_bug.cgi?id=108720Actually this error is a warning and boost is responsible for it. You can disable this special kind of warnings to omit them.
这种行为是 eclipse CDT 错误解析器的一个错误:https://bugs.eclipse.org/bugs/show_bug.cgi?id =108720 实际上这个错误是一个警告,boost 对此负责。您可以禁用这种特殊类型的警告以忽略它们。
回答by Andre
Did you actually returned? and check the types &state new_state and old_state. if you used: int new_state; and in the function compare_exchange(size_t &state, size_t new_state, size_t old_state) You get this error, well i did :)
你真的回来了吗?并检查类型&state new_state 和old_state。如果你使用:int new_state; 在函数 compare_exchange(size_t &state, size_t new_state, size_t old_state) 你得到这个错误,我做得很好:)
state_data const current_state = interlocked_compare_exchange(&state,new_state,old_state);
add:
添加:
return new_state;