<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[boost::thread Problem]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich benutze Visual C++ 2010 und boost 1.43.0</p>
<p>Beim ersten Beispiel motzt der Compiler:<br />
&quot;main.cpp|16|error C2228: left of '.join' must have class/struct/union&quot;</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/thread.hpp&gt;

struct F
{
    void operator ()()
    {
        std::cout &lt;&lt; &quot;hello\n&quot;;
    }
};

int main()
{
    boost::thread t(F());

    t.join();

  return 0;
}
</code></pre>
<p>Geht:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/thread.hpp&gt;

struct F
{
    void operator ()()
    {
        std::cout &lt;&lt; &quot;hello\n&quot;;
    }
};

int main()
{
    boost::thread t = boost::thread(F());

    t.join();

  return 0;
}
</code></pre>
<p>Weiss jemand den Grund dafür? Der typ von t ist ja in beiden Fällen gleich.<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/269536/boost-thread-problem</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 03:22:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/269536.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 Jun 2010 08:13:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to boost::thread Problem on Sun, 27 Jun 2010 08:13:26 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich benutze Visual C++ 2010 und boost 1.43.0</p>
<p>Beim ersten Beispiel motzt der Compiler:<br />
&quot;main.cpp|16|error C2228: left of '.join' must have class/struct/union&quot;</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/thread.hpp&gt;

struct F
{
    void operator ()()
    {
        std::cout &lt;&lt; &quot;hello\n&quot;;
    }
};

int main()
{
    boost::thread t(F());

    t.join();

  return 0;
}
</code></pre>
<p>Geht:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/thread.hpp&gt;

struct F
{
    void operator ()()
    {
        std::cout &lt;&lt; &quot;hello\n&quot;;
    }
};

int main()
{
    boost::thread t = boost::thread(F());

    t.join();

  return 0;
}
</code></pre>
<p>Weiss jemand den Grund dafür? Der typ von t ist ja in beiden Fällen gleich.<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1917818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1917818</guid><dc:creator><![CDATA[__Stefan__]]></dc:creator><pubDate>Sun, 27 Jun 2010 08:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to boost::thread Problem on Sun, 27 Jun 2010 08:22:23 GMT]]></title><description><![CDATA[<p>explicit-Magie.</p>
<pre><code class="language-cpp">class thread : private boost::noncopyable   // Exposition only
{
public:
  // construct/copy/destruct
  thread();
  explicit thread(const boost::function0&lt;void&gt;&amp;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1917819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1917819</guid><dc:creator><![CDATA[Zeus]]></dc:creator><pubDate>Sun, 27 Jun 2010 08:22:23 GMT</pubDate></item><item><title><![CDATA[Reply to boost::thread Problem on Sun, 27 Jun 2010 08:28:21 GMT]]></title><description><![CDATA[<p>Einfach mal die Warnungen anschauen:</p>
<pre><code>main.cpp(14): warning C4930: 'boost::thread t(F (__cdecl *)(void))': prototyped function not called (was a variable definition intended?)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1917820</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1917820</guid><dc:creator><![CDATA[life]]></dc:creator><pubDate>Sun, 27 Jun 2010 08:28:21 GMT</pubDate></item><item><title><![CDATA[Reply to boost::thread Problem on Sun, 27 Jun 2010 08:32:25 GMT]]></title><description><![CDATA[<p>life schrieb:</p>
<blockquote>
<p>Einfach mal die Warnungen anschauen:</p>
<pre><code>main.cpp(14): warning C4930: 'boost::thread t(F (__cdecl *)(void))': prototyped function not called (was a variable definition intended?)
</code></pre>
</blockquote>
<p>Die Warnung kommt bei mir nur wenn ich das join() weglasse.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/4791">@Zeus</a><br />
Aber das ist doch keine implizite Umwandlung:</p>
<pre><code class="language-cpp">boost::thread t(F());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1917823</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1917823</guid><dc:creator><![CDATA[__Stefan__]]></dc:creator><pubDate>Sun, 27 Jun 2010 08:32:25 GMT</pubDate></item><item><title><![CDATA[Reply to boost::thread Problem on Sun, 27 Jun 2010 08:40:31 GMT]]></title><description><![CDATA[<p>Das ist eine Funktionsdeklaration, falls das immer noch nicht klar geworden war..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1917824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1917824</guid><dc:creator><![CDATA[life]]></dc:creator><pubDate>Sun, 27 Jun 2010 08:40:31 GMT</pubDate></item><item><title><![CDATA[Reply to boost::thread Problem on Sun, 27 Jun 2010 08:54:53 GMT]]></title><description><![CDATA[<p>Hrrrm, okay. Ich wusste gar nicht dass Funktionsdeklarationen im Code erlaubt sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1917828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1917828</guid><dc:creator><![CDATA[__Stefan__]]></dc:creator><pubDate>Sun, 27 Jun 2010 08:54:53 GMT</pubDate></item></channel></rss>