无法在 ubuntu 11.04 上使用 gcc 4.5 编译 boost::signal 教程
我正在尝试完成 http://www.boost.org/doc/libs/1_47_0/doc/html/signals/tutorial.html#id2850736
但是 Eclipse CDT显示使用我使用的任何语法的解析错误
我有
#include <boost/signals.hpp>
首选语法
boost::signal<void (float, float)> sig;
sig.connect(&print_sum);
信号处的模板参数无效
无法解析“连接”方法
移植语法
boost::signal2<float, float, float> sig;
sig.connect(&print_sum);
无法解析“连接”方法
无法解析符号“signal2”
我使用 eclipse 3.7
I'm trying to complete the boost::signal tutorial at http://www.boost.org/doc/libs/1_47_0/doc/html/signals/tutorial.html#id2850736
However Eclipse CDT shows parsing errors with whichever syntax I use
I have
#include <boost/signals.hpp>
Preferred syntax
boost::signal<void (float, float)> sig;
sig.connect(&print_sum);
Invalid template arguments at signal
Method 'connect' could not be resolved
Portable syntax
boost::signal2<float, float, float> sig;
sig.connect(&print_sum);
Method 'connect' could not be resolved
Symbol 'signal2' could not be resolved
I use eclipse 3.7
看来是CDT的问题。您最近更新了 eclipse 版本吗? Eclipse 论坛中有关于该主题的讨论:
http://www.eclipse.org /forums/index.php/t/216821/
也许它会给您一些关于如何解决该问题的灵感。
编辑:作为临时解决方法,您可以禁用某些代码分析功能和标记。为此,请转到“窗口”->“首选项”->“C/C++”->“代码分析”并禁用部分或全部问题。我已禁用所有功能,因为它仍然会突出显示编译期间发现的错误,并且我不会因错误声明的问题而感到困惑。
It seems to be a CDT issue. Have you updated your eclipse version lately? There is a discussion on that topic in the eclipse forum going on:
http://www.eclipse.org/forums/index.php/t/216821/
Maybe it gives you some inspiration on how to work around that problem.
EDIT: As a temporary work around, you can disable certain code analysis features and markers. To do so, go to Window->Preferences->"C/C++"->"Code Analysis" and disable some or all problems. I have disabled all, since it will still highlight errors found during the compilation and I will not be confused by falsely declared problems.