<?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]]></title><description><![CDATA[<p>Hallo,<br />
ich habe das Beispiel aus einem Buch:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/thread.hpp&gt;
using namespace std;

void f(int t){
    boost::this_thread::sleep(boost::posix_time::seconds(t));
    cout &lt;&lt; &quot;Thread&quot; &lt;&lt; boost::this_thread::get_id()&lt;&lt;&quot; : Funktion beendet! Laufzeit = &quot; &lt;&lt; t &lt;&lt; &quot; s&quot;&lt;&lt;endl;
}
int main() {
    boost::thread t1(f,4);
    boost::thread t2(f,6);
    boost::thread t3(f,2);
    cout &lt;&lt; &quot;t1.get_id(): &quot; &lt;&lt; t1.get_id() &lt;&lt; endl;
    cout &lt;&lt; &quot;t2.get_id(): &quot; &lt;&lt; t2.get_id() &lt;&lt; endl;
    cout &lt;&lt; &quot;t3.get_id(): &quot; &lt;&lt; t3.get_id() &lt;&lt; endl;
    t1.join();
    t2.join();
    t3.join();
    cout &lt;&lt; &quot;main() ist beendet&quot; &lt;&lt; endl;
    return (0);
}
</code></pre>
<p>Allerdings bekomme ich da Fehler:</p>
<pre><code>Undefined symbols:
  &quot;vtable for boost::detail::thread_data_base&quot;, referenced from:
      __ZTVN5boost6detail16thread_data_baseE$non_lazy_ptr in main.o
  &quot;boost::thread::join()&quot;, referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
  &quot;boost::this_thread::sleep(boost::posix_time::ptime const&amp;)&quot;, referenced from:
      void boost::this_thread::sleep&lt;boost::posix_time::seconds&gt;(boost::posix_time::seconds const&amp;)in main.o
  &quot;boost::thread::get_id() const&quot;, referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
  &quot;boost::thread::~thread()&quot;, referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
      _main in main.o
      _main in main.o
      _main in main.o
  &quot;boost::this_thread::get_id()&quot;, referenced from:
      f(int) in main.o
  &quot;typeinfo for boost::detail::thread_data_base&quot;, referenced from:
      typeinfo for boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, void (*)(int), boost::_bi::list1&lt;boost::_bi::value&lt;int&gt; &gt; &gt; &gt;in main.o
  &quot;boost::detail::thread_data_base::~thread_data_base()&quot;, referenced from:
      boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, void (*)(int), boost::_bi::list1&lt;boost::_bi::value&lt;int&gt; &gt; &gt; &gt;::~thread_data()in main.o
      boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, void (*)(int), boost::_bi::list1&lt;boost::_bi::value&lt;int&gt; &gt; &gt; &gt;::~thread_data()in main.o
  &quot;boost::thread::start_thread()&quot;, referenced from:
      boost::thread::thread&lt;void (*)(int), int&gt;(void (*)(int), int)in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-MacOSX/cppapplication_1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
</code></pre>
<p>Kann sich das einer erklären?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/263556/boost-thread</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 19:16:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/263556.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Mar 2010 18:03:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Boost::thread on Mon, 22 Mar 2010 18:03:21 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe das Beispiel aus einem Buch:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/thread.hpp&gt;
using namespace std;

void f(int t){
    boost::this_thread::sleep(boost::posix_time::seconds(t));
    cout &lt;&lt; &quot;Thread&quot; &lt;&lt; boost::this_thread::get_id()&lt;&lt;&quot; : Funktion beendet! Laufzeit = &quot; &lt;&lt; t &lt;&lt; &quot; s&quot;&lt;&lt;endl;
}
int main() {
    boost::thread t1(f,4);
    boost::thread t2(f,6);
    boost::thread t3(f,2);
    cout &lt;&lt; &quot;t1.get_id(): &quot; &lt;&lt; t1.get_id() &lt;&lt; endl;
    cout &lt;&lt; &quot;t2.get_id(): &quot; &lt;&lt; t2.get_id() &lt;&lt; endl;
    cout &lt;&lt; &quot;t3.get_id(): &quot; &lt;&lt; t3.get_id() &lt;&lt; endl;
    t1.join();
    t2.join();
    t3.join();
    cout &lt;&lt; &quot;main() ist beendet&quot; &lt;&lt; endl;
    return (0);
}
</code></pre>
<p>Allerdings bekomme ich da Fehler:</p>
<pre><code>Undefined symbols:
  &quot;vtable for boost::detail::thread_data_base&quot;, referenced from:
      __ZTVN5boost6detail16thread_data_baseE$non_lazy_ptr in main.o
  &quot;boost::thread::join()&quot;, referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
  &quot;boost::this_thread::sleep(boost::posix_time::ptime const&amp;)&quot;, referenced from:
      void boost::this_thread::sleep&lt;boost::posix_time::seconds&gt;(boost::posix_time::seconds const&amp;)in main.o
  &quot;boost::thread::get_id() const&quot;, referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
  &quot;boost::thread::~thread()&quot;, referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
      _main in main.o
      _main in main.o
      _main in main.o
  &quot;boost::this_thread::get_id()&quot;, referenced from:
      f(int) in main.o
  &quot;typeinfo for boost::detail::thread_data_base&quot;, referenced from:
      typeinfo for boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, void (*)(int), boost::_bi::list1&lt;boost::_bi::value&lt;int&gt; &gt; &gt; &gt;in main.o
  &quot;boost::detail::thread_data_base::~thread_data_base()&quot;, referenced from:
      boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, void (*)(int), boost::_bi::list1&lt;boost::_bi::value&lt;int&gt; &gt; &gt; &gt;::~thread_data()in main.o
      boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, void (*)(int), boost::_bi::list1&lt;boost::_bi::value&lt;int&gt; &gt; &gt; &gt;::~thread_data()in main.o
  &quot;boost::thread::start_thread()&quot;, referenced from:
      boost::thread::thread&lt;void (*)(int), int&gt;(void (*)(int), int)in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-MacOSX/cppapplication_1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
</code></pre>
<p>Kann sich das einer erklären?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1872630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872630</guid><dc:creator><![CDATA[Thomas22]]></dc:creator><pubDate>Mon, 22 Mar 2010 18:03:21 GMT</pubDate></item><item><title><![CDATA[Reply to Boost::thread on Mon, 22 Mar 2010 18:08:11 GMT]]></title><description><![CDATA[<p>Thomas22 schrieb:</p>
<blockquote>
<p>Kann sich das einer erklären?</p>
</blockquote>
<p>Klar, du musst noch gegen die libboost_thread linken. Im Gegensatz zu vielen Sachen in boost ist boost.thread keine reine Header-Bibliothek.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1872633</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872633</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Mon, 22 Mar 2010 18:08:11 GMT</pubDate></item><item><title><![CDATA[Reply to Boost::thread on Mon, 22 Mar 2010 18:12:50 GMT]]></title><description><![CDATA[<p>Ok. Jetzt gehts. Ich hatte vorher das Lib Verzeichnis angegeben, warum reicht das denn nicht zu. Also das, /lib wo die bosst libs drin sind. Warum reicht das denn nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1872639</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872639</guid><dc:creator><![CDATA[Thomas22]]></dc:creator><pubDate>Mon, 22 Mar 2010 18:12:50 GMT</pubDate></item><item><title><![CDATA[Reply to Boost::thread on Mon, 22 Mar 2010 18:21:52 GMT]]></title><description><![CDATA[<p>Thomas22 schrieb:</p>
<blockquote>
<p>Ok. Jetzt gehts. Ich hatte vorher das Lib Verzeichnis angegeben, warum reicht das denn nicht zu. Also das, /lib wo die bosst libs drin sind. Warum reicht das denn nicht?</p>
</blockquote>
<p>Nur weil der Linker eine Bibliothek finden kann, heißt das noch nicht, dass auch dagegen gelinkt wird. Dein Linker dürfte Hunderte oder sogar Tausende von verschiedenen Bibliotheken in seinen Suchpfaden haben. Soll der die alle nach einem passenden Symbol durchsuchen? Was meinst du wieviele Symbole in all den Bibliotheken mehrfach vorkommen? Welches soll dann das richtige sein?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1872641</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872641</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 22 Mar 2010 18:21:52 GMT</pubDate></item></channel></rss>