Can not compile boost::signal tutorial using gcc 4.5 on ubuntu 11.04
Asked Answered
C

1

6

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

Capone answered 31/7, 2011 at 9:40 Comment(5)
Portable syntax should be signal2 - is this just a copy&paste error?Nike
Sorry, I'm not familiar with stackoverflow editor.Capone
Do you link with boost_signals library?Paleobiology
yes, I added boost_signals and boost_system to linkerCapone
These are linker issues, not compiler.Gusty
G
12

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.

Greaser answered 4/8, 2011 at 0:12 Comment(2)
and restart eclipse after making the changes to Code AnalysisElspeth
the same problem nearly 5 years later (#40644383). Any ideas how to solve correctly and without turning off code-analysis ?Smearcase

© 2022 - 2024 — McMap. All rights reserved.