<?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[Code kompiliert mit MSVC++ aber nicht mit g++]]></title><description><![CDATA[<p>Hi,</p>
<p>folgender Code (im Forum gefunden) wird mit MSVC++ ohne Probleme kompiliert aber unter Linux mit dem G++, bekomme ich folgende Fehlermeldung:</p>
<pre><code>error: 'class std::random_device' has no member named 'generate'
</code></pre>
<pre><code>boost::dynamic_bitset&lt;&gt; generate(boost::dynamic_bitset&lt;&gt;::size_type n)
{ 
   static std::random_device rd;
   const int bpb  = boost::dynamic_bitset&lt;&gt;::bits_per_block; 
   std::vector&lt;boost::dynamic_bitset&lt;&gt;::block_type&gt; arr((n+bpb-1)/bpb); 
   static std::independent_bits_engine&lt;std::minstd_rand, 
		 boost::dynamic_bitset&lt;&gt;::bits_per_block, 
		 boost::dynamic_bitset&lt;&gt;::block_width_type&gt; engine(rd); 

   std::generate(arr.begin(), arr.end(),std::ref(engine)); 
   boost::dynamic_bitset&lt;&gt; ret(std::begin(arr), std::end(arr)); 
   return ret; 
}
</code></pre>
<p>Wenn die dritt und viertletzte Zeile auskommentiert ist dann klappt es.</p>
<p>Woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/321021/code-kompiliert-mit-msvc-aber-nicht-mit-g</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 13:15:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/321021.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Oct 2013 07:36:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 07:36:46 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>folgender Code (im Forum gefunden) wird mit MSVC++ ohne Probleme kompiliert aber unter Linux mit dem G++, bekomme ich folgende Fehlermeldung:</p>
<pre><code>error: 'class std::random_device' has no member named 'generate'
</code></pre>
<pre><code>boost::dynamic_bitset&lt;&gt; generate(boost::dynamic_bitset&lt;&gt;::size_type n)
{ 
   static std::random_device rd;
   const int bpb  = boost::dynamic_bitset&lt;&gt;::bits_per_block; 
   std::vector&lt;boost::dynamic_bitset&lt;&gt;::block_type&gt; arr((n+bpb-1)/bpb); 
   static std::independent_bits_engine&lt;std::minstd_rand, 
		 boost::dynamic_bitset&lt;&gt;::bits_per_block, 
		 boost::dynamic_bitset&lt;&gt;::block_width_type&gt; engine(rd); 

   std::generate(arr.begin(), arr.end(),std::ref(engine)); 
   boost::dynamic_bitset&lt;&gt; ret(std::begin(arr), std::end(arr)); 
   return ret; 
}
</code></pre>
<p>Wenn die dritt und viertletzte Zeile auskommentiert ist dann klappt es.</p>
<p>Woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361731</guid><dc:creator><![CDATA[CPlusPlus45]]></dc:creator><pubDate>Mon, 21 Oct 2013 07:36:46 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 07:43:08 GMT]]></title><description><![CDATA[<p>Fehlende C++11-Unterstützung?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361733</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Mon, 21 Oct 2013 07:43:08 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 07:51:09 GMT]]></title><description><![CDATA[<p>Ich benutze g++ version 4.7.2 mit -std=c++11 flag</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361736</guid><dc:creator><![CDATA[CPlusPlus45]]></dc:creator><pubDate>Mon, 21 Oct 2013 07:51:09 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 07:57:14 GMT]]></title><description><![CDATA[<p>hä ich verstehe die fehlermeldung nicht. es wird doch nirgends im code std::random_device::generate versucht aufzurufen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361740</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361740</guid><dc:creator><![CDATA[dfgdsgd]]></dc:creator><pubDate>Mon, 21 Oct 2013 07:57:14 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 08:22:30 GMT]]></title><description><![CDATA[<p>den header &lt;algorithm&gt; eingebunden ? in dem liegt generate nämlich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361743</guid><dc:creator><![CDATA[vario-500]]></dc:creator><pubDate>Mon, 21 Oct 2013 08:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 08:38:44 GMT]]></title><description><![CDATA[<p>Ja alles eingebunden, das Programm laeuft ja unter Windows aber unter Linux auf einmal nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361746</guid><dc:creator><![CDATA[CPlusPlus45]]></dc:creator><pubDate>Mon, 21 Oct 2013 08:38:44 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 08:46:03 GMT]]></title><description><![CDATA[<p>Der Konstruktor will wohl keinen generator, sondern ein seed.</p>
<pre><code class="language-cpp">static std::independent_bits_engine&lt;std::minstd_rand,
              boost::dynamic_bitset&lt;&gt;::bits_per_block,
              boost::dynamic_bitset&lt;&gt;::block_width_type&gt; engine(rd());
</code></pre>
<p>Aber wieso sollte VC das kompilieren?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361749</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Mon, 21 Oct 2013 08:46:03 GMT</pubDate></item><item><title><![CDATA[Reply to Code kompiliert mit MSVC++ aber nicht mit g++ on Mon, 21 Oct 2013 09:03:10 GMT]]></title><description><![CDATA[<p>Danke jetzt klappt es! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> Ich benutze Visual C++ 2010 Prof. Ich bin kein C++ Experte aber in der Header finde ich diese def. da steht was von &quot;Engine&quot;</p>
<pre><code>template&lt;class _Engine,
	size_t _Wx,
	class _UIntType&gt;
	class independent_bits_engine
	{	// template class for independent_bits_engine compound engine
public:
	typedef independent_bits_engine&lt;_Engine, _Wx, _UIntType&gt; _Myt;
	typedef _Engine base_type;
	typedef _UIntType result_type;
	typedef typename _Engine::result_type _Eres;

	independent_bits_engine()
		{	// construct
		_Init();
		}

	explicit independent_bits_engine(const base_type&amp; _Ex)
		: _Eng(_Ex)
		{	// construct with engine initializer _Ex
		_Init();
		}

	explicit independent_bits_engine(result_type _X0)
		: _Eng(_X0)
		{	// construct from specified seed value
		_Init();
		}

	explicit independent_bits_engine(seed_seq&amp; _Seq)
		: _Eng(_Seq)
		{	// construct from seed sequence
		_Init();
		}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2361754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361754</guid><dc:creator><![CDATA[CPlusPlus45]]></dc:creator><pubDate>Mon, 21 Oct 2013 09:03:10 GMT</pubDate></item></channel></rss>