The problem about exercise 4 methods of RTT exercise

I follow the guide and define a new method:<br><br><br><span style="background-color: rgb(255, 204, 255);">Method&lt; void(const std::string&amp;) &gt; method_2;</span><br style="background-color: rgb(255, 204, 255);"><span style="background-color: rgb(255, 204, 255);">void sayIt(const std::string&amp; word)</span><br style="background-color: rgb(255, 204, 255);">
<span style="background-color: rgb(255, 204, 255);">{</span><br style="background-color: rgb(255, 204, 255);"><span style="background-color: rgb(255, 204, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(Info)&lt;&lt;word&lt;&lt;endlog();</span><br style="background-color: rgb(255, 204, 255);">
<span style="background-color: rgb(255, 204, 255);">}</span><br style="background-color: rgb(255, 204, 255);"><span style="background-color: rgb(255, 204, 255);">method_2(&quot;the_method_2&quot;,&amp;Hello::sayIt, this);</span><br>
<br><br><span style="background-color: rgb(204, 204, 204);"></span>But when I add it using:<br><span style="background-color: rgb(255, 204, 255);">this-&gt;methods()-&gt;addMethod(&amp;method_2, &quot;&#39;the_method_2&#39; Description&quot;);</span><br>
<br>The Boost gives me errors like:<br><span style="background-color: rgb(255, 204, 255);">&quot;g++ -g -o helloworld HelloWorld.cpp -I/usr/local/include -DOROCOS_TARGET=gnulinux -Wall -L/usr/local/lib -Wl,-rpath /usr/local/lib -lorocos-taskbrowser-gnulinux -lorocos-rtt-gnulinux</span><br style="background-color: rgb(255, 204, 255);">
<span style="background-color: rgb(255, 204, 255);">/usr/local/include/rtt/MethodRepository.hpp: In member function 'bool RTT::MethodRepository::addMethod(MethodT, const char*) [with MethodT = RTT::Method&lt;void ()(const std::string&amp;)&gt;*]':</span><br style="background-color: rgb(255, 204, 255);">
<span style="background-color: rgb(255, 204, 255);">HelloWorld.cpp:93:&nbsp;&nbsp; instantiated from here</span><br style="background-color: rgb(255, 204, 255);"><span style="background-color: rgb(255, 204, 255);">/usr/local/include/rtt/MethodRepository.hpp:175: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE&lt;false&gt;' </span><br style="background-color: rgb(255, 204, 255);">
<span style="background-color: rgb(255, 204, 255);">make: *** [helloworld] Error 1</span><br style="background-color: rgb(255, 204, 255);"><span style="background-color: rgb(255, 204, 255);">&quot;</span><br><br><br>I think it&#39;s about the data type that addMethod can not support.<br>
Anyone has ideas to solve it??<br><br><br>Thanks,<br>GL<br><br>

The problem about exercise 4 methods of RTT exercise

On Tuesday 27 January 2009 19:49:57 guoliang liu wrote:
> I follow the guide and define a new method:
>
>
> Method< void(const std::string&) > method_2;
> void sayIt(const std::string& word)
> {
> log(Info)<<word<<endlog();
> }
> method_2("the_method_2",&Hello::sayIt, this);
>
>
> But when I add it using:
> this->methods()->addMethod(&method_2, "'the_method_2' Description");
>
> The Boost gives me errors like:
> "g++ -g -o helloworld HelloWorld.cpp -I/usr/local/include
> -DOROCOS_TARGET=gnulinux -Wall -L/usr/local/lib -Wl,-rpath /usr/local/lib
> -lorocos-taskbrowser-gnulinux -lorocos-rtt-gnulinux
> /usr/local/include/rtt/MethodRepository.hpp: In member function 'bool
> RTT::MethodRepository::addMethod(MethodT, const char*) [with MethodT =
> RTT::Method<void ()(const std::string&)>*]':
> HelloWorld.cpp:93: instantiated from here
> /usr/local/include/rtt/MethodRepository.hpp:175: error: invalid application
> of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>'
> make: *** [helloworld] Error 1
> "
>
>
> I think it's about the data type that addMethod can not support.
> Anyone has ideas to solve it??

This is explained in the manual and the API documentation of addMethod. For
each argument of your method, you need to supply the name and a description.
So it should be:

&#10; this-&gt;methods()-&gt;addMethod(&amp;method_2, &quot;&#039;the_method_2&#039; Description&quot;, &#10;&quot;sentence&quot;, &quot;The sentence to say (a string).&quot;);&#10;

The same holds for commands and events.

Peter

The problem about exercise 4 methods of RTT exercise

Thanks very much, it&#39;s solved.<br><br><div class="gmail_quote">2009/1/27 Peter Soetens <span dir="ltr">&lt;<a href="mailto:peter [dot] soetens [..] ...">peter [dot] soetens [..] ...</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Tuesday 27 January 2009 19:49:57 guoliang liu wrote:<br>
&gt; I follow the guide and define a new method:<br>
&gt;<br>
&gt;<br>
&gt; Method&lt; void(const std::string&amp;) &gt; method_2;<br>
&gt; void sayIt(const std::string&amp; word)<br>
&gt; {<br>
&gt; &nbsp; &nbsp; &nbsp; log(Info)&lt;&lt;word&lt;&lt;endlog();<br>
&gt; }<br>
&gt; method_2(&quot;the_method_2&quot;,&amp;Hello::sayIt, this);<br>
&gt;<br>
&gt;<br>
&gt; But when I add it using:<br>
&gt; this-&gt;methods()-&gt;addMethod(&amp;method_2, &quot;&#39;the_method_2&#39; Description&quot;);<br>
&gt;<br>
&gt; The Boost gives me errors like:<br>
&gt; &quot;g++ -g -o helloworld HelloWorld.cpp -I/usr/local/include<br>
&gt; -DOROCOS_TARGET=gnulinux -Wall -L/usr/local/lib -Wl,-rpath /usr/local/lib<br>
&gt; -lorocos-taskbrowser-gnulinux -lorocos-rtt-gnulinux<br>
&gt; /usr/local/include/rtt/MethodRepository.hpp: In member function &#39;bool<br>
&gt; RTT::MethodRepository::addMethod(MethodT, const char*) [with MethodT =<br>
&gt; RTT::Method&lt;void ()(const std::string&amp;)&gt;*]&#39;:<br>
&gt; HelloWorld.cpp:93: &nbsp; instantiated from here<br>
&gt; /usr/local/include/rtt/MethodRepository.hpp:175: error: invalid application<br>
&gt; of &#39;sizeof&#39; to incomplete type &#39;boost::STATIC_ASSERTION_FAILURE&lt;false&gt;&#39;<br>
&gt; make: *** [helloworld] Error 1<br>
&gt; &quot;<br>
&gt;<br>
&gt;<br>
&gt; I think it&#39;s about the data type that addMethod can not support.<br>
&gt; Anyone has ideas to solve it??<br>
<br>
</div></div>This is explained in the manual and the API documentation of addMethod. For<br>
each argument of your method, you need to supply the name and a description.<br>
So it should be:<br>
<br>
&lt;code&gt;<br>
&nbsp;this-&gt;methods()-&gt;addMethod(&amp;method_2, &quot;&#39;the_method_2&#39; Description&quot;,<br>
&quot;sentence&quot;, &quot;The sentence to say (a string).&quot;);<br>
&lt;/code&gt;<br>
<br>
The same holds for commands and events.<br>
<br>
Peter<br>
<font color="#888888">--<br>
Peter Soetens -- FMTC -- &lt;<a href="http://www.fmtc.be" target="_blank">http://www.fmtc.be</a>&gt;<br>
<br>
</font></blockquote></div><br>